Skip to content

fix(free-layout): refresh lines after JSON layout - #1157

Open
linhongyu510 wants to merge 2 commits into
bytedance:mainfrom
linhongyu510:fix/from-json-line-render
Open

fix(free-layout): refresh lines after JSON layout#1157
linhongyu510 wants to merge 2 commits into
bytedance:mainfrom
linhongyu510:fix/from-json-line-render

Conversation

@linhongyu510

@linhongyu510 linhongyu510 commented Aug 14, 2026

Copy link
Copy Markdown

Summary

Refresh free-layout edges after fromJSON() has rendered and browser layout has settled.

Ports may not have final DOM measurements during the initial render. Updating lines immediately can therefore leave edges at stale positions until another interaction triggers a refresh.

This change schedules a line refresh on the next animation frame and manages that deferred callback safely:

  • keeps only the latest refresh across repeated fromJSON() calls
  • cancels a pending refresh when a later call uses fireRender=false
  • cancels pending work when the document is disposed
  • does not change the existing synchronous render path

Validation

  • vitest run in free-layout-core — 11 files, 88 tests passed
  • ESLint on the changed implementation and tests
  • tsc --noEmit
  • git diff --check

Regression tests cover deferred refresh, default layout configuration, disabled rendering, repeated loads, and cancellation of stale callbacks.

AI assistance

This change was developed with AI assistance. I reviewed the animation-frame lifecycle and ran the package-level checks above.

@CLAassistant

CLAassistant commented Aug 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@linhongyu510

linhongyu510 commented Aug 28, 2026

Copy link
Copy Markdown
Author

Friendly ping on this one — the CLA is signed and local validation is green. GitHub Actions are currently awaiting maintainer approval for this fork PR. This fixes free-layout lines not refreshing after a JSON-driven layout. Could a maintainer help approve the workflows and take a look / assign a reviewer when convenient? Happy to rebase or adjust if needed. Thanks!

@linhongyu510

Copy link
Copy Markdown
Author

Correction to my previous note: the remote status currently contains only the successful CLA check, and there are no GitHub check runs for this head. The implementation evidence is local validation on the PR head (88 Vitest tests, ESLint, tsc --noEmit, and git diff --check), not upstream CI. The PR remains ready for maintainer review; no action is needed on the branch unless requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants