-
Notifications
You must be signed in to change notification settings - Fork 879
fix(joint-react): fix links flickering #3159
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
base: dev
Are you sure you want to change the base?
Conversation
…intJS elements and links - Add BatchCache class for managing batched updates for links, ports, and clear views. - Introduce ClearViewCacheEntry and related functions for managing clear view updates. - Create PortUpdateCacheEntry and functions for merging port updates and groups. - Implement state flushing functions to handle element and link updates in a React-friendly manner. - Develop example story demonstrating cell actions with dynamic node and link management. - Define GraphSchedulerData type for unified scheduling of updates across elements, links, and ports.
…in various components and tests - Updated GraphProvider stories to remove 'id' from elements and links. - Cleaned up highlighter tests by removing 'id' from element definitions. - Adjusted stroke highlighter tests to eliminate 'id' from elements. - Modified paper tests to remove 'id' from elements and links. - Refactored port tests to exclude 'id' from elements. - Updated hooks tests to remove 'id' from elements. - Cleaned up model tests by removing 'id' from ReactElement and ReactLink instances. - Adjusted example stories to remove 'id' from elements and links.
791bf5a to
33b456b
Compare
| type ReactPaperOptionsBase = OmitWithoutIndexSignature< | ||
| dia.Paper.Options, | ||
| 'frozen' | 'defaultLink' | 'autoFreeze' | 'viewManagement' | ||
| 'frozen' | 'defaultLink' | 'autoFreeze' | 'viewManagement' | 'measureNode' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this @kumilingus
| @@ -0,0 +1,288 @@ | |||
| /* eslint-disable prefer-destructuring */ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add immediate handling when an element is added to the observer.
The observer is attached instantly, but it only detects changes on the next animation frame.
To eliminate this delay, we immediately measure the HTML element, while still processing measurements in a batch.
Description
Fixes link flickering issue where links would briefly appear before element content was rendered.
Motivation and Context
The Bug: When rendering a Paper with elements and links, the visual sequence was:
This happened because JointJS renders link SVG paths synchronously, while React portals render element content via microtask (later).
Changes
create-elements-size-observer.tsto ensure consistent timing between link paths and element contentpaper-link-flickering.test.tsx) that verifies the invariant: "If links are visible with rendered paths, elements must also have their content rendered"