Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Add an ADR to improve React representations rendering #3962

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mcharfadi
Copy link
Contributor

@mcharfadi mcharfadi commented Sep 4, 2024

Pull request template

General purpose

What is the main goal of this pull request?

  • Bug fixes
  • New features
  • Documentation
  • Cleanup
  • Tests
  • Build / releng

Project management

  • Has the pull request been added to the relevant project and milestone? (Only if you know that your work is part of a specific iteration such as the current one)
  • Have the priority: and pr: labels been added to the pull request? (In case of doubt, start with the labels priority: low and pr: to review later)
  • Have the relevant issues been added to the pull request?
  • Have the relevant labels been added to the issues? (area:, difficulty:, type:)
  • Have the relevant issues been added to the same project and milestone as the pull request?
  • Has the CHANGELOG.adoc been updated to reference the relevant issues?
  • Have the relevant API breaks been described in the CHANGELOG.adoc? (Including changes in the GraphQL API)
  • In case of a change with a visual impact, are there any screenshots in the CHANGELOG.adoc? For example in doc/screenshots/2022.5.0-my-new-feature.png

Architectural decision records (ADR)

  • Does the title of the commit contributing the ADR start with [doc]?
  • Are the ADRs mentioned in the relevant section of the CHANGELOG.adoc?

Dependencies

  • Are the new / upgraded dependencies mentioned in the relevant section of the CHANGELOG.adoc?
  • Are the new dependencies justified in the CHANGELOG.adoc?

Frontend

This section is not relevant if your contribution does not come with changes to the frontend.

General purpose

  • Is the code properly tested? (Plain old JavaScript tests for business code and tests based on React Testing Library for the components)

Typing

We need to improve the typing of our code, as such, we require every contribution to come with proper TypeScript typing for both changes contributing new files and those modifying existing files.
Please ensure that the following statements are true for each file created or modified (this may require you to improve code outside of your contribution).

  • Variables have a proper type
  • Functions’ arguments have a proper type
  • Functions’ return type are specified
  • Hooks are properly typed:
    • useMutation<DATA_TYPE, VARIABLE_TYPE>(…)
    • useQuery<DATA_TYPE, VARIABLE_TYPE>(…)
    • useSubscription<DATA_TYPE, VARIABLE_TYPE>(…)
    • useMachine<CONTEXT_TYPE, EVENTS_TYPE>(…)
    • useState<STATE_TYPE>(…)
  • All components have a proper typing for their props
  • No useless optional chaining with ?. (if the GraphQL API specifies that a field cannot be null, do not treat it has potentially null for example)
  • Nullable values have a proper type (for example let diagram: Diagram | null = null;)

Backend

This section is not relevant if your contribution does not come with changes to the backend.

General purpose

  • Are all the event handlers tested?
  • Are the event processor tested?
  • Is the business code (services) tested?
  • Are diagram layout changes tested?

Architecture

  • Are data structure classes properly separated from behavioral classes?
  • Are all the relevant fields final?
  • Is any data structure mutable? If so, please write a comment indicating why
  • Are behavioral classes either stateless or side effect free?

Review

How to test this PR?

Please describe here the various use cases to test this pull request

  • Has the Kiwi TCMS test suite been updated with tests for this contribution?

CHANGELOG.adoc Outdated
@@ -16,6 +16,8 @@
- [ADR-154] Add support for finding parent in tree representation
- [ADR-155] Add max-width expression for diagram labels
- [ADR-156] Make it possible to display the semantic elements as a tree in the Selection Dialog
- [ADR-156] Make it possible to display the semantic elements as a tree in the Selection Dialog
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate of line "ADR-156"

With the actual implementation, when we receive a new payload to update the representation we also update all the components under it.


This causes a noticeable impact on performance with representation rendering lots of elements and particularly if they use lots of interactions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what "use lots of interactions" means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll change the phrasing, I wanted to point out representation that have more way to interact with than others (like diagrams)

Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
@mcharfadi mcharfadi force-pushed the mch/doc/representation_rendering branch from ab5f500 to 3cdca28 Compare September 9, 2024 08:43
Comment on lines +7 to +14
When we want to access a representation we have to subscribe to it.


Each time a representation changes, a new payload is sent to the subscribers of this representation.


This guarantee that all subscribers of a representation are in synch with the actual data of the representation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop putting two empty lines between sentences. A simple line return is enough.

Comment on lines +159 to +161
We should start by comparing the payloads when the client receives and update only the revelant React Component.

Then measure the performance improvements before trying a more complex approach.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand in the grand scheme of things how we could use a solution like that but I don't see what would motive it right now.

The changes sended by the back-end could look like the changes used by the ReactFlow renderer meaning for the nodes

That would be a massive change in itself. While it would certainly help with minor operations like moving a node, most of what is possible in a diagram has a sizable impact, potentially changing dozens of elements in a diagram. I'm not even sure that "computing the incremental change" would be faster than just sending the new diagram. I'm not sure which performance problem identified RIGHT NOW you would solve with this.

Our approach to performance improvements will be guided by concrete performance problems identified right now. This ADR involves multiples massive architectural changes on both the backend and the frontend of multiple parts of the code. It may make some good points but it's way too vague and generic.

If you want to move forward with such proposal, when you will have time affected to performance improvement or during a cool down:

  • Find and measure a specific performance problem that affects our end users
  • Come up with an ADR to solve that specific problem

We could move forward one day with incremental changes sent over the subscription for representations, we could move forward with other kind of changes for tree based representations too but in this state, I don't understand what clear issue this ADR is trying to solve and how it would solve it. The constraints we have one tree based representations and diagram or form based representations are very different and the solution would have to be tailor made for each use case. I feel that this document should probably be 2 or 3 different ADRs but I don't clearly see the performance issue identified for each use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants