[COMMS-909] First headline not rendered correctly when opening a document - #24946
Conversation
|
Caution The provided work package version does not match the core version Details:
Please make sure that:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses a BlockNote/Yjs collaboration bootstrap race where the very first heading block in a persisted document can initially render at paragraph size until the next user interaction. It introduces a client-side refresh on load and adds a feature spec to prevent regressions.
Changes:
- Add a
useLayoutEffectworkaround to force-refresh the initial block when its id isinitialBlockId. - Add a Selenium feature spec that reproduces the “first heading renders as paragraph until click” issue and asserts correct rendering after reload.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| modules/documents/spec/features/block_note_editor_spec.rb | Adds a feature spec verifying the first heading renders at full size immediately after reload (COMMS-909). |
| frontend/src/react/components/OpBlockNoteEditor.tsx | Forces a one-time initial block refresh on mount to trigger correct heading rendering. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ment https://community.openproject.org/wp/COMMS-909 The problem only applies to a headline that is created in the very first line in a new document (and this line not heavily edited before or after). It always occurred with a headline in a div with data-id="initialBlockId". The data-id can be removed by BlockNote when editing, so it seemed like this bug was only triggered sometimes, while in fact it was very deterministic.
3af9228 to
c51b662
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
The problem only applies to a headline that is created in the very first line in a new document (and this line not heavily edited before or after). It always occurred with a headline in a div with data-id="initialBlockId". The data-id can be removed by BlockNote when editing, so it seemed like this bug was only triggered sometimes, while in fact it was very deterministic.
Details to the actual bug (which needs to be adressed in BlockNote) are here: TypeCellOS/BlockNote#3013
Ticket
https://community.openproject.org/wp/COMMS-909
What are you trying to accomplish?
Workaround a bug that would wrongly render the first headline as paragraph in certain circumstances, until the first user interaction, which then would "expand" the headline to its actual size (see screencast attached to the work package: https://community.openproject.org/api/v3/attachments/922948/content )
What approach did you choose and why?
Since the bug is deeply in BlockNote / yjs collaboration, it's out of scope to apply a real fix inside OpenProject. Rather, the symptom is fixed by forcing a refresh of the affected block after document load (instead of waiting for the first user interaction, which would then also trigger the refresh).
Merge checklist