Skip to content

Carry collections through Save Build / Load Build - #783

Open
chiliec wants to merge 1 commit into
pascalorg:mainfrom
chiliec:fix/load-build-collections
Open

Carry collections through Save Build / Load Build#783
chiliec wants to merge 1 commit into
pascalorg:mainfrom
chiliec:fix/load-build-collections

Conversation

@chiliec

@chiliec chiliec commented Sep 8, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes #734 — Save Build / Load Build dropped collections on both sides. Same shape as #729 (materials):

  • handleSaveBuild now includes collections in the saved sceneData.
  • validateBuildJson gets a collections pass: each entry is checked against the Collection shape (id, name, nodeIds: string[], optional color/controlNodeId); invalid entries are skipped with an invalid_collections warning that names the skipped ids, a non-object collections is ignored with a warning. Valid entries land on parsed.collections.
  • handleConfirmImport passes parsed.collections through to setScene (which already accepted extra.collections).

How to test

  1. Create a collection in the editor, Save Build, then Load Build the same file → the collection is still there (before: gone).
  2. bun --cwd packages/core run test — 4 new tests in validate-build-json.test.ts under collections (carry-through, per-entry skip with warning, non-object warning, absent → omitted from parsed).
  3. Reverting the validate-build-json.ts change makes 3 of those tests fail; with it they pass. Full packages/core suite: 1430 pass / 0 fail. packages/editor tests: 836 pass / 0 fail, tsc --noEmit for packages/editor clean.

Screenshots / screen recording

n/a — no UI change, only the saved file contents and the import pass.

Checklist

  • I've tested this locally with bun dev (verified via the package test suites + tsc --noEmit instead; happy to add a clip if you'd like one)
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Note

Low Risk
Scoped to build JSON validation and settings-panel save/import wiring; no auth or security paths, and invalid collection data is warn-and-skip rather than hard-failing import.

Overview
Fixes collections being dropped on Save Build and Load Build, mirroring the existing materials round-trip.

Save Build now writes collections from the scene store into the exported JSON alongside nodes, materials, and plugins. Load Build passes parsed.collections into setScene after import validation.

validateBuildJson gains a collections pass: valid entries (required id, name, nodeIds: string[], optional color / controlNodeId) appear on parsed.collections; bad entries are skipped with an invalid_collections warning that lists skipped ids; a non-object collections field is ignored with a warning; absent collections stay omitted from parsed. Four unit tests cover carry-through, partial skip, invalid top-level shape, and omission when missing.

Reviewed by Cursor Bugbot for commit fc5bf17. Bugbot is set up for automated code reviews on this repo. Configure here.

@pascal

pascal Bot commented Sep 8, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: b2126f81-7fc5-4800-9c2c-d21556b11d63

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.

Save Build / Load Build round-trip drops collections

1 participant