Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/react-elements-measured-app-resize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@joint/react": patch
---

useOnElementsMeasured - fix to fire exactly once per settled change, when no element is still waiting to be measured
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ function SVGElementItemComponent(props: ElementItemProps) {
const graphStore = useGraphStore();
const { paper } = usePaper();
useLayoutEffect(() => {
// Runs after the portal subtree's layout effects, so a `useMeasureElement`
// inside `renderElement` has already registered with the size observer
// (in HTML overlay mode this item follows `HTMLElementItem`, which renders
// the user content, in sibling order). O(1), and a no-op on re-runs.
graphStore.markElementRendered(id);
if (!paper) return;
graphStore.clearViewForElementAndLinks({
cellId: id,
Expand Down
Loading
Loading