fix(editor): load the core's defaults-filled document, trial guide fixes

This commit is contained in:
bchanot committed 2026-11-04 15:35:19 +01:00
1 parent 0d167df271
commit bb99edd2dd
5 files changed
+48 -54

No files matched your search

+9 -2
View File
@@ -52,7 +52,13 @@ async function loadDraft(client: FaunosteoClient, versionId: string): Promise<Lo
preview.free()
return { ok: false, failure: coreFailure(state.kind) }
}
const loaded = { version: read.version, text, preview, state: state.value, attached }
const loaded = {
version: read.version,
text: JSON.stringify(state.value.document),
preview,
state: state.value,
attached,
}
return { ok: true, loaded }
}
@@ -190,9 +196,10 @@ function applyReload(
}
const attached = attachDrawings(preview, read.drawings)
const next = preview.state()
const filled = next.ok ? next.value : replaced.state
removeCopy(state.userId ?? '', state.versionId ?? '')
api.set({
...reloadPatch(state, text, next.ok ? next.value : replaced.state, read.revision),
...reloadPatch(state, JSON.stringify(filled.document), filled, read.revision),
drawings: [...state.drawings, ...attached.held],
drawingFailures: { ...state.drawingFailures, ...attached.failures },
})