fix(text-node): persist text in label so it survives reload
text_content is not in the API serializer schema, so text node content was dropped on save and the node came back empty after reload. Store text in label instead — already persisted, and TextNode + the edit modal already fall back to label, so existing data stays compatible. Clear stale text_content on update. Regression test added for the text-node save/load roundtrip.
This commit is contained in:
@@ -412,3 +412,24 @@ describe('round-trip: serialize → deserialize', () => {
|
||||
expect(restored.height).toBe(300)
|
||||
})
|
||||
})
|
||||
|
||||
// ── text nodes survive save+reload (regression for #lost text node) ──────────
|
||||
describe('serializeNode — text node roundtrip', () => {
|
||||
const emptyMap = new Map<string, boolean>()
|
||||
|
||||
it('persists text content through label so it survives reload', () => {
|
||||
const node = makeRfNode({
|
||||
type: 'text',
|
||||
data: {
|
||||
label: 'Hello world',
|
||||
type: 'text',
|
||||
status: 'unknown',
|
||||
services: [],
|
||||
},
|
||||
})
|
||||
const serialized = serializeNode(node) as ApiNode
|
||||
expect(serialized.label).toBe('Hello world')
|
||||
const restored = deserializeApiNode(serialized, emptyMap)
|
||||
expect(restored.data.label).toBe('Hello world')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user