Repository navigation
fix(whiteboard): exit shape editing synchronously on slide change - #25726
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe whiteboard now completes an active shape edit before a decode-gated slide swap prunes shapes from the previous page. This clears Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 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: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation 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)
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. Comment |
✅ Automated tests have passed! |
29cc156
into
bigbluebutton:v4.0.x-develop
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 leavesselect.editing_shapewhile the shape being edited still exists. The existingcheck inside
applyPageSwapis kept as a second line of defense for an editthat 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.
[curPageId]page swap, immediately before the store mutation that removesthe old page's shapes.
img.decode()race, to stop the white flash on slide change (Client: slide area renders blank after slide navigation until the slide SVG loads (tldraw background asset race) #25397).[removedShapes]and the shapes-diffpruning) are unguarded and still run immediately. 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 trips tldraw's
Expected an editing shape!assertion and crashes the client - the exact crash fix(whiteboard): prevent crash when slide changes while a viewer is editing #25345 addressed, now
dependent on the subscription-update vs SVG-decode race.
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 editingregression 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
Expected an editing shape!(more likely with a cold asset cache or aslow/loaded machine, which widens the decode window).
whiteboard/whiteboard.spec.ts > Whiteboard tools > No crash on slide change while a viewer is editing.Notes
bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx.Related: #25332, #25345, #25493, #25397, #25723