feat(joint-react): InferElement/InferLink, LinkModel generics + React Compiler test harness#3352
Merged
kumilingus merged 6 commits intoJun 11, 2026
Conversation
…tils - Introduced tests for the React compiler to verify auto-memoization behavior. - Added tests for the `useCells` hook to ensure reactivity with graph membership. - Created tests for the `Paper` component to validate interactive features. - Implemented type-level tests for `ElementModel` and `LinkModel` generics. - Added tests for `element` and `link` utility functions to ensure correct behavior and type inference.
…a retrieval in ElementModel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
InferElement/InferLinktype utilities (src/utils/create.ts, exported fromsrc/index.ts): extract the element/link record from a cells array (typeof cells) by itstypediscriminant. Index['data']for the render-data type; compose withComputedfor reading hooks.LinkModeladopts the JointJS generic form (src/mvc/link-model.ts):extends dia.Link<Attributes>instead ofdia.Link<dia.Link.Attributes & Attributes>, soLinkModel<LinkRecord<Data>>keepsdatatyped instead of widening it toany. React-side only — no@joint/corechange.jest.config.js,package.json): jest split intodefault(@swc/jest) andreact-compiler(babel-plugin-react-compiler,target: '19').*.compiler.test.tsxruns only under the compiler project and asserts auto-memoization is active and@joint/reactbehaviour is unchanged when compiled.create.test.ts(InferElement/InferLink),element-model.test.ts(generic usage + custom-attribute round-trip),use-cells-reactivity.test.tsx(11 tests — id / single-id / collection membership reactivity),paper-interactive.test.tsx(interactiveenableslinkMove).paper.types.ts):renderElementJSDoc clarified — the callback receives the element'sdataslice, typed viaInferElement<typeof cells>['data'].Motivation and Context
datashapes from a cells array (InferElement/InferLink).LinkModel<LinkRecord<Data>>previously lost itsdatatyping; the JointJS generic surface fixes it without touching core.@joint/reactbehaviour, plus regression coverage foruseCellsreactivity andPaperinteractivity.Screenshots (if appropriate):