Skip to content

fix(whiteboard): exit shape editing synchronously on slide change - #25726

Merged
antobinary merged 1 commit into
bigbluebutton:v4.0.x-developfrom
antobinary:whiteboard40-sep01
Sep 2, 2026
Merged

antobinary merged 1 commit into
bigbluebutton:v4.0.x-developfrom
antobinary:whiteboard40-sep01

Conversation

@antobinary

Copy link
Copy Markdown
Member

What does this PR do?

Commits a viewer's in-progress whiteboard edit synchronously at the top of the
[curPageId] effect, before the decode gate starts, so tldraw leaves
select.editing_shape while the shape being edited still exists. The existing
check inside applyPageSwap is kept as a second line of defense for an edit
that begins during the decode wait.

Why

This is a timing regression of #25332 (fixed in #25345), re-opened by the
decode-gated slide swap from #25493.

The race usually resolves the safe way (decode wins), which is why CI stayed
green until the No crash on slide change while a viewer is editing
regression test caught it on a loaded runner in #25723 - a test-only PR that
cannot itself have introduced a client crash.

How to reproduce / verify

  1. Presenter grants multi-user whiteboard access.
  2. Viewer picks the text tool, clicks the canvas and types, staying mid-edit.
  3. Presenter advances the slide; viewer clicks the canvas afterwards.
  4. Without this fix the viewer client can crash with
    Expected an editing shape! (more likely with a cold asset cache or a
    slow/loaded machine, which widens the decode window).
  5. The Playwright regression test covering this is
    whiteboard/whiteboard.spec.ts > Whiteboard tools > No crash on slide change while a viewer is editing.

Notes

  • 8-line change in
    bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx.
  • The full mechanism analysis is in the commit message body.

Related: #25332, #25345, #25493, #25397, #25723

The fix for issue 25332 (72e5511) committed a viewer's in-progress edit
inside the [curPageId] page swap, so tldraw left select.editing_shape before
the store mutation removed the shape being edited. The decode-gated swap
(e66e9eb) later deferred that whole swap - guard included - behind an
img.decode() race, re-opening the window through a different door: the
shapes-sync removal effects ([removedShapes] and the shapes-diff pruning) are
unguarded and still run immediately, so when the viewer's shape subscription
re-keys to the new page before the decode resolves, the edited shape is
removed while the editor still holds a dangling editingShapeId. The viewer's
next pointer-down then trips tldraw's "Expected an editing shape!" assertion
and crashes the client - exactly the crash the original fix addressed, now
timing-dependent on subscription-update vs SVG-decode. Caught by the
'No crash on slide change while a viewer is editing' regression test on CI
(PR bigbluebutton#25723), where a loaded runner lost the race.

Commit the edit synchronously at the top of the [curPageId] effect, before
the decode gate starts, restoring the original ordering guarantee regardless
of how the race resolves. The check inside applyPageSwap stays as a second
line of defense for an edit that begins during the decode wait.
@antobinary antobinary added this to the Release 4.0 milestone Sep 1, 2026
@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 08ab22b1-728f-4895-8218-9c2f7259f3dd

📥 Commits

Reviewing files that changed from the base of the PR and between 9d321a1 and 7ad021f.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The whiteboard now completes an active shape edit before a decode-gated slide swap prunes shapes from the previous page. This clears select.editing_shape and prevents a dangling editingShapeId during subsequent pointer events.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7ad02

This localized whiteboard change finishes an active edit before slide-transition cleanup, preventing stale editor state and a client crash; no actionable merge-blocking risk remains beyond normal checks.

Suggested reviewers: ramonlsouza, imdt-claudiop

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: exiting shape editing synchronously when the slide changes.
Description check ✅ Passed The description directly explains the whiteboard crash, the timing regression, the fix, and the regression test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary
antobinary merged commit 29cc156 into bigbluebutton:v4.0.x-develop Sep 2, 2026
62 of 63 checks passed
@antobinary
antobinary deleted the whiteboard40-sep01 branch September 2, 2026 14:55
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.

2 participants