Skip to content

saveProject: a registered bridge composes with the OPFS commit - #548

Merged
maboa merged 1 commit into
mainfrom
fix/bridge-save-composes-with-opfs
Aug 11, 2026
Merged

saveProject: a registered bridge composes with the OPFS commit#548
maboa merged 1 commit into
mainfrom
fix/bridge-save-composes-with-opfs

Conversation

@maboa

@maboa maboa commented Aug 11, 2026

Copy link
Copy Markdown
Member

The native bridge hook (#449) predates the project library (#456), and their interaction shipped wrong: registering hyperaudioProjectBridge makes saveProject() skip the OPFS commit entirely — an embedder that accepts the container hand-off silently loses saved.json/draft semantics, the undo-aware dirty state, restore-on-reload, and everything else the library's save provides. The hook was designed for OPFS-less wrappers; any embedder that has OPFS gets the worse of both worlds.

With a bridge and OPFS available, save now commits first and hands the finished container to the bridge afterwards. A bridge failure is the bridge's to report and never un-commits. The bridge-only short-circuit remains for OPFS-less contexts, where the hand-off genuinely is the save. Behaviour without a bridge is untouched, and asSave's clean-marking rules apply unchanged.

Three lines of logic plus comments; in production use in a native wrapper where every ⌘S runs this path.

The native bridge hook (#449) predates the project library (#456), and
their interaction shipped wrong: registering hyperaudioProjectBridge
made saveProject() skip the OPFS commit entirely — an embedder that
accepts the container hand-off silently loses saved.json/draft
semantics, the undo-aware dirty state, and everything else the library's
save provides.

With a bridge AND OPFS available, save now commits first and hands the
finished container to the bridge afterwards; a bridge failure is the
bridge's to report and never un-commits. The bridge-only short-circuit
remains for OPFS-less contexts, where the hand-off genuinely IS the
save. Behaviour without a bridge is untouched.
@maboa
maboa merged commit d6cbda4 into main Aug 11, 2026
1 check passed
@maboa maboa mentioned this pull request Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant