AcadeDoc/apps
Corentin 9139fb8728 fix(acadenice): pass content object directly to jsonb param + remove empty text nodes — Patch 028
Two bugs in template seed/instantiate:

1. ${JSON.stringify(content)}::jsonb made Postgres store the content as
   a jsonb scalar string (jsonb_typeof = 'string'), not an object. The
   instantiate read it back as a JSON-encoded string, which ProseMirror
   tried to parse as a node tree and crashed with 'Unknown node type:
   undefined' on the outer string. Pass the object directly with
   ${content as unknown as string}::jsonb so postgres-js binds it as
   a JSONB value.

2. Built-in template seed used { type: 'paragraph', content: [{ type:
   'text', text: '' }] } for empty paragraphs / list items / task
   items. ProseMirror schema rejects empty text nodes ('Empty text
   nodes are not allowed'). Replaced with content: [].

Verified via curl: POST /api/acadenice/templates/{id}/instantiate now
returns 201 with the new pageId/slugId.

Patch 028.
2026-05-08 13:01:10 +02:00
..
client fix(client): switch bridge token to import.meta.env (Vite auto-expose) — Patch 025 2026-05-08 12:44:18 +02:00
extension-clipper feat(acadenice): add sync blocks for cross-page content sharing — R4.2 2026-05-08 11:40:12 +02:00
server fix(acadenice): pass content object directly to jsonb param + remove empty text nodes — Patch 028 2026-05-08 13:01:10 +02:00