Skip to content

v2 collaboration: create.contentControl fails with INVALID_CONTEXT unsupported-context (2.11) — on 2.10 it succeeded but was silently reverted by sync #3974

Description

@furilo

What happened?

In a v2 collaboration room, doc.create.contentControl cannot create a content control at all:

  • 2.11.0: every call fails immediately with { success: false, failure: { code: "INVALID_CONTEXT", message: "content-control-create: unsupported-context" } }. I tried kind: "inline" and kind: "block", several controlTypes (text, checkbox, richText), with and without content/lockMode, with a valid collapsed and non-collapsed at SelectionTarget (verified via doc.selection.current() right before the call). Same result in a freshly created room (roomMode: "create") and in existing rooms.
  • 2.10.0: the same call returns success and the SDT renders — but it never syncs. It doesn't reach a second client on the same room, doesn't survive a reload, and disappears from the creating tab itself within ~30s when the collaborative overlay re-syncs. create.paragraph in the same room syncs to the other client instantly and persists, so the room/provider are fine — it's specific to content controls.

With collaboration off (same document passed as a plain File) the identical call succeeds and persists on both versions. So 2.11 looks like it turned 2.10's silent revert into a fail-fast — consistent with the 2.11 release notes ("Collaborative edits now persist through page reloads", "inline content controls no longer corrupt at run boundaries") — but the operation itself remains unsupported in collaboration.

Console repro (any collab-mounted doc):

const doc = superdoc.activeEditor.doc;
const { blocks } = await doc.blocks.list({ includeText: true, limit: 1 });
const point = { kind: "text", blockId: blocks[0].nodeId, offset: 0 };
await doc.create.contentControl({
  kind: "inline",
  controlType: "text",
  at: { kind: "selection", start: point, end: point },
  tag: "my-tag",
  alias: "My field",
  content: "value",
});
// 2.11: { success: false, failure: { code: "INVALID_CONTEXT", message: "content-control-create: unsupported-context" } }
// 2.10: { success: true, ... } but the control silently vanishes on the next overlay sync

Version/room matrix I tested (same Hocuspocus server throughout):

runtime room bootstrapped by result
2.11.0 2.10 or 2.11 INVALID_CONTEXT
2.10.0 2.10 success, then silently reverted by sync
2.10.0 2.11 INVALID_CONTEXT
2.10.0 / 2.11.0 no collaboration works and persists

Digging in the bundle, the failure seems to come from a byte-apply guard: the unsupported-context return sits next to mainStoryOverlayRequiresExactSave / mainStoryBootstrapSliceExactSaveEligible / sourceCompletePosture checks, so my read is that SDT creation needs an exact-save-eligible main story source and the collaborative posture never qualifies.

Maybe related to the v2 collab overlay-commit family: #3920, #3917.

Our template-variable and fillable-field features are built on inline SDTs created through the Document API, so right now there is no way to insert any of them in collaborative documents. Happy to provide more details or test a fix.

Steps to reproduce

With examples/collaboration (Hocuspocus) and any .docx:

  1. Open the creating client and wait for ready.
  2. Run the console snippet above — INVALID_CONTEXT: content-control-create: unsupported-context on 2.11.0.
  3. On 2.10.0 the same snippet resolves success: true and the control renders; open the room in a second tab (never arrives) or reload (gone), or just wait ~30s in the same tab (reverted).
  4. Mount the same file without v2Collaboration — the control is created and persists on both versions.

SuperDoc version

2.11.0 (docx-engine 0.10.0); also reproduced on 2.10.0 (docx-engine 0.9.0)

Browser

Chrome

Additional context

Collaboration config: document: { id, type: "docx", data: <File>, v2Collaboration: { providerType: "hocuspocus", documentId, serverUrl, token, roomMode: "create" | "join" } }, own Hocuspocus server.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stage: to-doPrioritized and ready to be picked up

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions