fix(joint-react): reactive visual grid + inline-style precedence - #3430
Merged
Conversation
…anges useCreatePortalPaper only called setGrid/setGridSize per-prop, so drawGridSize changes and grid options set via the options escape hatch left the rendered grid pattern stale. Recompute the grid from paper.options and re-run setGrid whenever drawGrid/drawGridSize/gridSize actually changes, guarded by an equality check to avoid needless redraws. Adds regression tests: the reactive grid redraw, and that an inline style prop stays authoritative over className on the paper host element. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kumilingus
approved these changes
Jul 23, 2026
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
Two
<Paper/>bug fixes, split out of #3428 so they can ship ahead of the larger feature work in that PR.1. Visual grid is not reactive (
fix)useCreatePortalPaperonly pushed grid changes to the paper with per-propsetGrid/setGridSizecalls. As a result:drawGridSizechanges updated snapping (gridSize) but left the rendered grid pattern stale —setGridSizedeliberately skips the visual grid.optionsescape hatch were ignored entirely.The fix recomputes the grid from
paper.options(drawGrid/drawGridSize/gridSize) and re-runssetGridwhenever any of them actually changes, guarded by an equality check so unrelated re-renders don't trigger a redraw.2. Inline
stylevsclassNameprecedence (regression test)<Paper style={{ width: 1000 }} className="w-10" />should let the inline width win over the class, exactly like a plain HTML element. This already resolves correctly onmaster(the inlinestylelands on the.jj-paperhost element and the cascade favours it — there is no!importantinpaper.css), so this PR adds a regression test to lock the behaviour and guard against_setDimensionswiping the inline style.Motivation and Context
These are triaged
<Paper/>bugs (grid reactivity — Medium; style/className order — High) that users hit directly. They were developed alongside unrelated feature work in #3428; pulling them into their own PR lets the fixes be reviewed and released on their own timeline while the features continue separately. The changes remain in #3428 as well.Verification:
yarn testpasses — typecheck, lint, knip, jest 93 suites / 1028 tests (React 19) and 92 / 1024 (React 18), including the two new regression tests.Screenshots (if appropriate):