-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: optimize re-renders for builder-component #4172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx test @snippet/angular-17 |
❌ Failed | 11m 32s | View ↗ |
nx test @snippet/angular-17-ssr |
❌ Failed | 6m 12s | View ↗ |
nx test @snippet/vue |
❌ Failed | 3m 56s | View ↗ |
nx test @snippet/react |
❌ Failed | 3m 44s | View ↗ |
nx test @snippet/svelte |
❌ Failed | 3m 53s | View ↗ |
nx test @e2e/qwik-city |
✅ Succeeded | 10m 41s | View ↗ |
nx test @e2e/nextjs-sdk-next-app |
✅ Succeeded | 10m 15s | View ↗ |
nx test @e2e/nuxt |
✅ Succeeded | 10m 10s | View ↗ |
Additional runs (37) |
✅ Succeeded | ... | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-10-31 07:01:34 UTC
| // Resume change tracking - ensure this always runs even if deletion fails | ||
| onChange.resume(this.rootState); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Bug
The builder.resetSymbolState case performs state updates (Object.assign, setState) after change tracking resumes, defeating batching and risking inconsistent state if an error occurs during deletion. Separately, the builder.resetState case causes redundant re-renders by calling setState directly and then again via debouncedUpdateState.
Description
updateStatecalls whenever we call delete key on therootStateLoom
https://www.loom.com/share/4d19d3dacd14468aaa8f7e4a575fbe01
Note
Introduce
onChange.suspend/resumeand use them to batchrootStateresets inBuilderComponent, reducing unnecessary re-renders.packages/react/lib/on-change.js):SUSPEND/RESUMEsymbols andisSuspendedflag.onChange.suspend(proxy)andonChange.resume(proxy)APIs.ignoreChangenow skips notifications while suspended; handler exposes suspend/resume at root.packages/react/src/components/builder-component.component.tsx):builder.resetStateandbuilder.resetSymbolStatehandlers withonChange.suspend(this.rootState)/onChange.resume(this.rootState)to batch deletions/assignments.debouncedUpdateState(1s debounce) to coalesce updates.debouncedUpdateState = debounce(this.updateState, 1000).Written by Cursor Bugbot for commit 316c80d. This will update automatically on new commits. Configure here.