Files
webstudio/apps/builder
Oleg Isonen 13952a7d34 fix: Preserve Global root tokens when importing templates (#6348)
Inserting the CMS Sitemap marketplace page could detach existing Global
root tokens and break styles across existing pages. Preserve the root's
existing style-source selections in their original order, then append
mapped incoming sources without duplicates. Incoming local declarations
continue to merge into the existing root local source.

The MDX save fix is now included in main through
`commitAssetContentUpdate`. This PR retains an E2E assertion that saved
MDX revisions are not persisted again through `build.patch`.

Closes #6347

Verification and delivery:

- [x] Add four regression cases covering empty, local-only, token-only,
and mixed incoming root selections, including repeated imports, token
remapping, and local declaration merging. All four failed before the fix
and pass after it.
- [x] Rebase onto main and rerun style-copy and page-copy tests: 55
passed. Formatting and diff checks passed.
- [x] Verify the cloned project locally: reproduce the broken Home
canvas before the fix and restore it with Undo. After the fix, insert
Sitemap and verify Home retains its logo sizing, typography, spacing,
rounded corners, and both Global root tokens after reload.
- [x] Verify the MDX E2E assertion fails with duplicate persistence and
passes with the fix. Before rebase, all 13 shard 4 tests passed locally
with four workers, along with relevant typecheck and lint checks.
- [x] Resolve the rebase conflict using main's shared MDX implementation
and remove the duplicate helper from this branch.
- [x] Review documentation impact against marketplace, CSS-variable, and
Content Block documentation: no documentation changes required.
- [x] Review fixture impact: no fixture inputs, serialization formats,
or generated contracts changed.

No migrations are required. This prevents future imports from dropping
root selections; it does not reconstruct selections already lost in
previously saved projects.
2026-09-09 21:43:06 +02:00
..