feat(joint-react): dev warning when resizing an auto-sized element#3386
Merged
kumilingus merged 1 commit intoJun 24, 2026
Merged
Conversation
An element rendered without `useModelGeometry` is auto-sized — its HTMLBox/ HTMLHost measures the React content and writes the size back to the model. A tool resize (FreeTransform / Halo) or a direct `cell.resize()` is then immediately overwritten by the measurement pipeline, so it silently has no effect. GraphStore now attaches a dev-only `change:size` listener: when a size change carries no `autoSize` flag (i.e. it is not a measurement write) and the element is currently registered with the size observer (auto-size mode), it warns once per element via `warnResizeOnAutoSizedElement`. Tree-shaken in production; detached in `clean()`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
e9b0f19 to
f5a4b70
Compare
samuelgja
approved these changes
Jun 24, 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.
What
A dev-only console warning when an auto-sized element (rendered without
useModelGeometry, so its size is measured from the React content) is resized by a tool (FreeTransform / Halo) or a directcell.resize().Such resizes are immediately overwritten by the measurement pipeline, so they silently do nothing — the handles drag but the box snaps back to its content size. The warning tells the consumer they likely forgot
useModelGeometry.How
GraphStoreis the only place that owns both the graph (change:sizeevents) and the size-observer registration (observer.has(id)) — the only reliable runtime signal that an element is in auto-size mode (useModelGeometry/StaticHTMLFrameelements are never registered).utils/dev-warnings.ts— newwarnResizeOnAutoSizedElement(cellId), warn-once (sharedWARNEDset),process.env.NODE_ENV === 'production'guard (tree-shaken in prod). Matches the existingwarnUnstableSelector/warnDuplicatePapersstyle.store/graph-store.ts— dev-onlychange:sizelistener: warns when!opt.autoSize && observer.has(cell.id). Measurement writes are flaggedmodel.set(..., { autoSize: true }), so the pipeline's own writes are skipped. Detached inclean().Covers FreeTransform, Halo, and programmatic resizes uniformly — no per-tool wiring, no exposed observer internals.
Tests (
store/__tests__/graph-store.test.ts){ autoSize: true }) writesVerification
yarn jest graph-store.test→ 19 pass (3 new)yarn typecheckclean,yarn lintclean🤖 Generated with Claude Code