-
Notifications
You must be signed in to change notification settings - Fork 879
feat(joint-react): sync with @joint/react-plus + general updates #3077
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: master
Are you sure you want to change the base?
feat(joint-react): sync with @joint/react-plus + general updates #3077
Conversation
| export namespace highlighters { | ||
|
|
||
| import HighlighterView = dia.HighlighterView; | ||
| type HighlighterView = dia.HighlighterView; |
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.
This typing should be the same, but I had to change from that legacy Import to type because of a bundling issue.
| sourceMarker?: dia.SVGMarkerJSON; | ||
| targetMarker?: dia.SVGMarkerJSON; | ||
| sourceMarker?: dia.SVGMarkerJSON | null; | ||
| targetMarker?: dia.SVGMarkerJSON | null; |
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 added this type, because it return null in some cases.
| "eslint-plugin-jest": "^28.8.3", | ||
| "eslint-plugin-jsdoc": "^50.6.9", | ||
| "eslint-plugin-react": "^7.37.4", | ||
| "eslint-plugin-react-hooks": "5.1.0", |
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.
update to latest versions.
| "react": "^18.2.0", | ||
| "react-dom": "^18.2.0", | ||
| "react": "19.1.1", | ||
| "react-dom": "19.1.1", |
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.
also we have to keep this in sync, otherwise we will have issues with resolutions. So I Updated react, react-dom and react types versions accross monorepo.
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.
Pull Request Overview
This PR refactors the joint-react package to align with @joint/react-plus by simplifying the architecture and introducing controlled mode. The main changes include removing PaperProvider, adding controlled/uncontrolled modes to GraphProvider, and implementing performance optimizations.
Key changes:
- Removed
PaperProviderin favor of imperative API exposed on component refs - Added controlled mode support with
onElementsChange/onLinksChangeprops - Renamed
initialElements/initialLinkstoelements/linksfor consistency
Reviewed Changes
Copilot reviewed 209 out of 211 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/joint-vitest-plugin-mock-svg/package.json | Updated React/TypeScript dependencies to exact versions |
| packages/joint-react/vite.config.ts | Removed eslint disable comment, added @ts-expect-error |
| packages/joint-react/tsconfig.json | Modernized TypeScript config with bundler resolution |
| packages/joint-react/src/utils/* | Major refactoring of utilities including new scheduler, object utilities |
| packages/joint-react/src/hooks/* | Replaced useUpdateElement with useCellActions, updated store hooks |
| packages/joint-react/src/components/* | Updated to use new prop names and imperative API |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
9c4386a to
1086542
Compare
1086542 to
5311d16
Compare
… for managing elements and links
…implifying logic in various components
…plus-sync-and-updates
…t jitter for safari
…ndling and add useRefValue hook
…plus-sync-and-updates
…d new utility functions - Updated Storybook and Redux Toolkit versions in package.json and yarn.lock. - Refactored GraphProvider to accept elements and links as props directly. - Introduced new utility functions for improved link handling and object manipulation. - Added comprehensive tests for new functionalities and existing hooks. - Enhanced documentation with examples and best practices for using highlighters and SVG nodes.
9dae139 to
0321376
Compare
…comprehensive tests - Refactored GraphProvider to support controlled mode with direct synchronization of elements and links from React state. - Introduced new methods for updating the store from external data, improving state management. - Added extensive tests for controlled mode functionality, including handling rapid updates and user interactions. - Enhanced documentation with examples for using GraphProvider in controlled mode with Redux and React state.
…nce performance - Updated dependencies in yarn.lock, including Babel and added unplugin. - Refactored GraphProvider and Paper components for improved performance and clarity. - Removed unused files and hooks to streamline the codebase. - Enhanced the Storybook setup with a new script for loading react-scan. - Improved element rendering logic and optimized hooks for better state management. - Added tests for new functionalities and ensured existing tests are up to date.
212b78d to
8d9dbc0
Compare
- Added empty lines at the end of multiple test files to ensure consistency across the codebase.
…link from supported types in graphProvider. - graphProvider elements and links are source of truth - dia.graph do not change elements and links defined by the user - BY DeFAULT MAPPING - graph elements and links should be flat - remove measure node - useNodeSize | useNodeSize - custom mapper + default mappers from links and elements (???)
Description
This PR refactors
joint-react(and related packages) to simplify the architecture and prepare for@joint/plus-reactintegration.The main changes include the removal of
PaperProvider, the introduction of controlled mode inGraphProvider, and multiple performance optimizations.🚩 Major Changes
1. Controlled Mode in
GraphProviderdia.Graphremains the source of truth.onElementsChange/onLinksChangeprops are provided, React state becomes the source of truth.Enables integration with Redux, Zustand, or
useState.2.
PaperProviderRemovalPaperProviderlayer has been completely removed.All paper-related methods and refs are now accessible via the new imperative API exposed on the component ref.
This simplifies the render tree and eliminates redundant provider nesting.
3. API Changes
initialElements→elementsinitialLinks→linksMap-based caching; now uses plain arrays for better iteration performance.useImperativeApihook for managing refs and access to paper/graph internals.4. Store & Performance
use-element-viewsand render paths.5. Developer Experience
eslint,@types/react,typescript, etc.) and peer dependency ranges.Motivation and Context
This refactor simplifies both the runtime and mental model:
@joint/plus-reactecosystem.Screenshots
N/A — internal behavioral changes only.