bug: desktop app drops instance overrides when reopening a saved .fig (headless CLI reads them fine)
What happened?
When the desktop app opens a saved .fig file, instances lose their overrides. Text set through a component property and text set with set_text on an instance's child both come back as the component's default text. The headless CLI reads the same file with both overrides intact, so the file on disk is correct and the loss happens when the app loads it.
After the reopen, the instance still carries its property assignment (componentPropertyAssignments is {"0:5": "Override via properties"}), but it draws "Default title" and its instanceOverrides are empty. In our project, saving from a reopened tab then wrote the empty instances back to disk, so the damage became permanent.
Expected: the reopened instances show "Override via properties" and "Override via set_text", as they do before saving and as the CLI reads them.
A smaller, related effect: loading renumbers component property ids (title becomes 0:5) and variable mode ids (mode:5eed01 becomes 0:4). The CLI and the app agree on the new ids and the file's own references follow them, but anything outside the file that kept the old id stops matching. For example, a later render of <Instance of="Card" properties={{ title: "..." }} /> fails with "Unknown component property" after a reload.
Platform
Windows (Tauri), driven through the MCP server
Steps to reproduce
All through @open-pencil/mcp (stdio) against the desktop app; no app restart is needed.
new_documentwith pathrepro.fig.renderthis component set:
<ComponentSet name="Card" flex="row" gap={16} p={16} properties={[{ id: "title", name: "Title", type: "TEXT", defaultValue: "Default title" }]}>
<Component name="state=default" w={200} h={60} flex="col" p={12} bg="#FFFFFF" stroke="#E5E5E5" rounded={8}>
<Text name="Title" font="Inter" size={14} lineHeight={20} weight={500} color="#111111" propertyRefs={[{ propertyId: "title", field: "TEXT" }]}>{"Default title"}</Text>
</Component>
<Component name="state=selected" w={200} h={60} flex="col" p={12} bg="#EFF6FF" stroke="#2563EB" rounded={8}>
<Text name="Title" font="Inter" size={14} lineHeight={20} weight={500} color="#1D4ED8" propertyRefs={[{ propertyId: "title", field: "TEXT" }]}>{"Default title"}</Text>
</Component>
</ComponentSet>rendera frame with two instances:
<Frame name="Screen" w={480} h={220} flex="col" gap={16} p={16} bg="#FAFAFA">
<Instance name="Card A" of="Card" state="selected" properties={{ title: "Override via properties" }} />
<Instance name="Card B" of="Card" state="default" />
</Frame>set_texton Card B'sTitletext node: "Override via set_text".- For the id part:
create_collection"color",create_variable"color/surface", then throughopenpencil eval --document-id <tab>:figma.graph.addMode(collectionId, "mode:5eed01", "dark", defaultModeId)andfigma.graph.updateNode(screenId, { variableModes: { [collectionId]: "mode:5eed01" } }). save_filetorepro.fig.- Copy
repro.figtorepro-reload.figandopen_filethe copy, which opens it in a new tab. - Compare the Screen frame in the two tabs. The readouts below come from this eval, run with
openpencil eval --document-id <tab>against each tab and withopenpencil eval repro.figagainst the file:
const g = figma.graph;
const all = [...g.getAllNodes()];
const plain = (v) => JSON.parse(JSON.stringify(v, (k, x) => (x instanceof Map ? Object.fromEntries(x) : x)) || "null");
const texts = (n) => { const out = []; const walk = (x) => { if (!x) return; if (x.type === "TEXT") out.push(x.text); for (const c of x.childIds || []) walk(g.getNode(c)); }; walk(n); return out; };
const set = all.find((n) => n.name === "Card" && n.type === "COMPONENT_SET");
return JSON.stringify({
properties: set.componentPropertyDefinitions.map((p) => p.id + " = " + p.name),
instances: all.filter((n) => n.type === "INSTANCE").map((n) => ({ name: n.name, texts: texts(n), assignments: plain(n.componentPropertyAssignments), overrides: plain(n.instanceOverrides) })),
});Affected area
.fig import/export, Tauri desktop, MCP / automation
Version or build
Desktop app 0.15.1 on Windows, @open-pencil/cli 0.15.1, @open-pencil/mcp 0.15.1
Browser (web only)
n/a
Files, screenshots, or links
Possibly related: #641 (nested instance swaps lost across reload), #578 (nodes drift on a plain read/write round-trip) and #374 (frames moved across pages lost on save and reload, closed). I can attach repro.fig if that helps.
Console output or logs
# The tab that created and saved the file (never reopened)
properties: title = Title, prop:2a481918300c2824 = state
Card A (state=selected): texts ["Override via properties"], assignments {"title":"Override via properties"}
Card B (state=default): texts ["Override via set_text"]
color modes: 0:19890 = Mode 1, mode:5eed01 = dark; Screen variableModes {"0:19889":"mode:5eed01"}
# openpencil eval repro.fig (headless CLI, the saved file)
properties: 0:5 = Title, 0:6 = state
Card A: texts ["Override via properties"], assignments {"0:5":"Override via properties"}
Card B: texts ["Override via set_text"]
color modes: 0:19890 = Mode 1, 0:4 = dark; Screen variableModes {"0:19889":"0:4"}
# Desktop app, the same file opened in a new tab
properties: 0:5 = Title, 0:6 = state
Card A: texts ["Default title"], assignments {"0:5":"Override via properties"}, instanceOverrides {"self":{},"descendants":{}}
Card B: texts ["Default title"], instanceOverrides {"self":{},"descendants":{}}
color modes: 0:19890 = Mode 1, 0:4 = dark; Screen variableModes {"0:19889":"0:4"}Before submitting
- I searched existing issues and did not find a duplicate.
Source: open-pencil/open-pencil