Skip to content

Import: replace 'replace existing' toggle with 4 reconciliation modes#14

Merged
hefler merged 1 commit into
mainfrom
feature/import-merge-modes
Jul 9, 2026
Merged

Import: replace 'replace existing' toggle with 4 reconciliation modes#14
hefler merged 1 commit into
mainfrom
feature/import-merge-modes

Conversation

@hefler

@hefler hefler commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the single "replace existing variables" boolean toggle on the JSON import view with four explicit modes (ImportMode enum):
    • Merge — create missing collections/modes/variables, update matches by name. Nothing is ever deleted.
    • Update only — touch only what already exists in both the file and the document; nothing created, nothing deleted.
    • Merge and delete anything not in the file (Sync) — merge first, then delete anything anywhere in the document that isn't in the file, including whole collections the file never mentions. Matches are updated in place (not deleted+recreated), so their component bindings survive.
    • Clean import — today's existing behaviour: wipe every local collection, then import fresh. Every variable is recreated, so every existing component binding breaks, even where the recreated variable matches exactly.
  • Confirmation dialog now only gates Sync and Clean (the two modes that can delete something); its copy is tailored per mode.
  • ImportSummary gained variablesDeleted / modesDeleted / collectionsDeleted, surfaced in the import summary panel.

Test plan

  • npm run tsc
  • npm run build
  • Manual check in Figma: run each of the 4 modes against a document with existing variables/components bound to them, confirm bindings survive for Merge/Update only/Sync-matches and break only where expected

Splits the old boolean "replace existing variables" switch into Merge,
Update only, Sync (merge + delete anything not in the file, whole
document), and Clean import (today's wipe-then-import). Deleting a
variable in Figma always breaks any component bound to it, even if a
same-named variable is recreated, so the modes are ordered by how much
they risk that: Merge and Update only never delete; Sync deletes only
what has no match in the file (matches are updated in place, keeping
their bindings); Clean deletes and recreates everything up front.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hefler hefler merged commit 5b0405b into main Jul 9, 2026
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.

1 participant