I was getting this from Jean. I hope it makes sense!
Plan 1
Root cause:
after you leave edit mode and come back, the toolbar was sometimes comparing the current draft against the draft snapshot baseline instead of the published document baseline
that made the change count become
0, so Publish stayed grey
Fix:
frontend/packages/shared/src/models/use-unpublished-change-count.tswhen a draft exists, unpublished-change counting now compares against the published document content
it still falls back to machine draft blocks if the editor isn’t ready yet
frontend/packages/shared/src/models/__tests__/use-unpublished-change-count.test.tsxadded a regression test for:
editor not ready yet
re-entered editing with a draft where the old baseline incorrectly matched the draft
Recap
I fixed the bug so that when you re-enter editing context with unpublished changes, the Publish button should immediately become green again. The shared unpublished-change logic now always compares draft content against the published document baseline when a draft exists, instead of accidentally treating the reloaded draft as the baseline.
Files changed:
frontend/packages/shared/src/models/use-unpublished-change-count.ts,frontend/packages/shared/src/models/__tests__/use-unpublished-change-count.test.tsxThis is shared logic, so it should also cover web once you can test it.
The regression test now covers both “editor not ready” and “draft baseline overwritten on re-entry” cases.
Plan 2
I found another likely cause: BlockNote can reintroduce a trailing empty paragraph placeholder when you re-enter edit mode. That placeholder was being counted as a real unpublished change. I’m normalizing that out in the shared diff logic.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime