builder icon indicating copy to clipboard operation
builder copied to clipboard

fix: replace duplicate componentInfos with registeredComponents

Open intellix opened this issue 1 month ago • 3 comments

Description

We're trying to reduce the page size from using the Builder SDK. We've noticed there's about 1mb of component info stored in state and I noticed that the components are essentially stored twice in 2x different properties. The first step to reducing the payload is just using 1x: registeredComponents and passing it into the EnableEditor component to be used (the only place it is used).

Partially addresses #4166 and saves about 500kb of state (depending on component count ofc)

Screenshot

Screenshot 2025-10-26 at 11 01 58 Screenshot 2025-10-26 at 11 01 40

[!NOTE] Consolidates component registration by removing componentInfos from context and using registeredComponents passed from Content to EnableEditor for editor registration, with minor version bumps.

  • Content rendering:
    • Build state.registeredComponents from defaults + customComponents, serialize, and expose via ComponentsContext.
    • Pass registeredComponents to Blocks and to EnableEditor.
  • Editor integration:
    • EnableEditor now accepts registeredComponents and posts register messages from it; stops reading builderContextSignal.value.componentInfos.
  • Context/Types cleanup:
    • Remove componentInfos from BuilderContextInterface and default context.
  • Build/config:
    • Remove componentInfos injection from React Native context setup in mitosis.config.cjs.
  • Release:
    • Changeset: minor bumps for @builder.io/sdk and all framework SDKs.

Written by Cursor Bugbot for commit 47bee42bc23fa14122a0d35fd710270b9c3a3cfe. This will update automatically on new commits. Configure here.

intellix avatar Oct 26 '25 10:10 intellix

🦋 Changeset detected

Latest commit: 47bee42bc23fa14122a0d35fd710270b9c3a3cfe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@builder.io/sdk Minor
@builder.io/sdk-angular Minor
@builder.io/sdk-react-nextjs Minor
@builder.io/sdk-qwik Minor
@builder.io/sdk-react Minor
@builder.io/sdk-react-native Minor
@builder.io/sdk-solid Minor
@builder.io/sdk-svelte Minor
@builder.io/sdk-vue Minor
@builder.io/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 26 '25 10:10 changeset-bot[bot]

🤖 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 47bee42bc23fa14122a0d35fd710270b9c3a3cfe

Command Status Duration Result
nx test @e2e/nextjs-sdk-next-app ❌ Failed 23m 9s View ↗
nx test @snippet/nextjs-sdk-next-app ❌ Failed 15m 47s View ↗
nx test @snippet/angular-17 ❌ Failed 5m 44s View ↗
nx test @snippet/angular-17-ssr ❌ Failed 5m 32s View ↗
nx test @snippet/vue ❌ Failed 3m 33s View ↗
nx test @snippet/svelte ❌ Failed 2m 26s View ↗
nx test @snippet/react ❌ Failed 1m 58s View ↗
nx test @e2e/qwik-city ✅ Succeeded 9m 25s View ↗
Additional runs (37) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-10-30 10:13:52 UTC

nx-cloud[bot] avatar Oct 29 '25 19:10 nx-cloud[bot]

Thanks for reading through it and detailing the changes required :)

We've got a big project to deliver and already hacked this away in a PNPM patch (linked in my Issue) so I can't work on this right now but I can get back to it later maybe.

intellix avatar Oct 31 '25 10:10 intellix