feat: optimize re-renders for builder-component
Description
- prevent
updateStatecalls whenever we call delete key on therootState
Loom https://www.loom.com/share/4d19d3dacd14468aaa8f7e4a575fbe01
[!NOTE] Introduce
onChange.suspend/resumeand use them to batchrootStateresets inBuilderComponent, reducing unnecessary re-renders.
- State change tracking (
packages/react/lib/on-change.js):
- Add
SUSPEND/RESUMEsymbols andisSuspendedflag.- Expose
onChange.suspend(proxy)andonChange.resume(proxy)APIs.ignoreChangenow skips notifications while suspended; handler exposes suspend/resume at root.- Builder component (
packages/react/src/components/builder-component.component.tsx):
- Wrap
builder.resetStateandbuilder.resetSymbolStatehandlers withonChange.suspend(this.rootState)/onChange.resume(this.rootState)to batch deletions/assignments.- After reset, call
debouncedUpdateState(1s debounce) to coalesce updates.- Add
debouncedUpdateState = debounce(this.updateState, 1000).Written by Cursor Bugbot for commit 316c80d6d4a51be6f70c90cf0f2a8e8850a1a6b3. This will update automatically on new commits. Configure here.
⚠️ No Changeset found
Latest commit: 316c80d6d4a51be6f70c90cf0f2a8e8850a1a6b3
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
🤖 Nx Cloud AI Fix Eligible
An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.
To disable these notifications, a workspace admin can disable them in workspace settings.
View your CI Pipeline Execution ↗ for commit 316c80d6d4a51be6f70c90cf0f2a8e8850a1a6b3
| 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