Repository navigation
fix(html5): prevent white flash on slide change - #25493
ramonlsouza merged 4 commits into
Conversation
When navigating between slides, the presentation area flashed white until the new slide's background SVG loaded. The root cause was in the [curPageId] effect in whiteboard/component.jsx, which ran the visible page swap (cleanupStore + updateStore(bgShape) + setCurrentPage) synchronously, mounting the new slide's tldraw background image-shape before its SVG had been fetched/decoded. CSS does not paint a background-image whose resource has not loaded, so the area went blank until the asset arrived. Defer the swap behind an Image.decode() gate (bounded by a 1500ms timeout) so the previous slide stays painted until the new one is paintable. The decode reuses the HTTP cache the forward prefetch already warms (Auth.authenticateURL is idempotent, so the same URL hits the same cache entry). A broken/401/malformed asset swallows the decode rejection and degrades to applying the swap anyway - never worse than before. Rapid navigation is protected by a staleness/unmount guard: a late decode for an abandoned page cannot clobber the current one. The getEditingShape().complete() guard from issue 25332 now runs at swap moment, adjacent to the mutation it protects, preserving the crash fix. Two e2e specs added: no-blank-on-slide-change (RED before the fix, GREEN after) and broken-asset-degrades-without-hanging. Closes bigbluebutton#25397 Co-authored-by: Tainan Felipe <[email protected]>
- Drop the !isMountedRef.current guard from applyPageSwap. isMountedRef is not a mount flag: it is set true only late, inside adjustCameraOnMount after camera calibration, and stays false if calibration rethrows on an invalid viewbox. Gating the swap on it permanently stranded a viewer whose slide changed during the calibration window (the effect never re-fires for that curPageId). The cancelled flag already covers unmount fully; also re-check tlEditorRef, which can be torn down between the decode starting and resolving. - Add a .catch to the deferred swap so a throw in the store mutation is logged instead of escaping as an unhandled rejection (synchronously it reached ErrorBoundaryWithReload; inside the async .then there is no boundary). - Clear the fallback timer on the decode-wins path (.finally) and release the detached decode Image on cleanup so rapid navigation does not pin in-flight SVGs. - Make the decode timeout configurable via meetingClientSettings.public.whiteboard.slideSwapDecodeTimeoutMs (default 1500). - Correct the comments: the no-asset branch is the missing-svgUrl case (not infinite whiteboard), and pin the assets/curPageId lock-step invariant. Known limitation: on latency above the timeout the fallback fires before the asset is paintable and the original flash still shows.
…ression - Add a multi-user regression test: a viewer must follow a slide change that arrives while it is still calibrating, guarding the isMountedRef strand. - Widen the held-back-asset margin (600ms vs the 1500ms decode timeout) so CI jitter does not let the fallback timer win and flake the test. - Replace the tautological elapsed < 8000 assertion with elapsed < decode timeout measured after slide selection, proving a rejected decode short-circuits the gate. - Replace the fixed 3s sleep in waitForFirstSlidePainted with a wait on the real painted-slide condition. - Anchor the /svg/<n> background matcher so /svg/2 does not also match /svg/20. - Remove the pageerror listener in a finally, note the harmless route.abort console errors, and move the static class tunables to module consts.
Hoist the new page + its camera record out of the decode-gate and create them synchronously on the [curPageId] effect, before awaiting the decode. Remote annotations for the new page arrive via debouncedUpdateShapes (service.js, 175ms) parented to `page:N`; with the visible swap now deferred behind the decode (commonly past 175ms on the cold path), that debounce could otherwise put page-parented shapes before the page existed, which tldraw drops or throws on inside a debounce callback with no error boundary. Only the visible part of the swap (cleanupStore + background + setCurrentPage) stays gated. Re-surface a deferred-swap failure into render via a state setter so ErrorBoundaryWithReload catches it again, instead of only logging (the synchronous swap used to throw straight into the boundary). Lower the default decode-gate timeout to 250ms. The toolbar, zoom and camera are not gated, so a long wait leaves them on a stale slide; a short bound lets a cold asset fall through fast to the old behavior. Add the canonical default to meetingClientSettings (defaults object and Whiteboard type) alongside settings.yml so the TS shape does not drift from the yml. Tests: read/force the gate timeout at runtime (window.meetingClientSettings) instead of a source-literal mirror; drop the round-trip timing assertion in the broken-asset test for the outcome that matters (swap happens, no pageerror); force the calibration window deterministically in the viewer- follow test and state the invariant instead of citing a review finding; use the ELEMENT_WAIT_* constants so timeouts scale with TIMEOUT_MULTIPLIER. Move the presentation-slide Cache-Control change to its own PR: it carries an authorization-model tradeoff that warrants a separate maintainer decision.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughWhiteboard slide navigation now prepares target pages and cameras before waiting for the next background SVG to decode. The visible store swap occurs after decoding or a configurable timeout, with cancellation, navigation, unmount, and decode-error handling. A new Estimated code review effort: 4 (Complex) | ~60 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)bigbluebutton-html5/private/config/settings.ymlTraceback (most recent call last): 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! |
What does this PR do?
Fixes the presentation area flashing white for a moment when the slide changes.
Each slide is a separate tldraw page whose background is an image-shape pointing at that slide's SVG. The
[curPageId]effect swapped the visible page synchronously — it mounted the new background shape and calledsetCurrentPagebefore the SVG had been fetched — and CSS paints nothing for abackground-imagewhose resource hasn't loaded, so the canvas went blank until the asset arrived. On a warm cache it's a sub-frame flicker; on a cold one (backward navigation, or a forward jump past the 2-slide prefetch window) it's a clearly visible blank.Now the visible part of the swap (
cleanupStore+ background +setCurrentPage) waits on anImage.decode()of the new background, bounded by a short timeout (whiteboard.slideSwapDecodeTimeoutMs, default 250ms). The previous slide stays painted until the new one is paintable, and a slow or broken asset falls through to the old behavior instead of blocking navigation.The page and camera records are still created synchronously, ahead of the gate: remote annotations for the new page arrive on a 175ms debounce parented to
page:N, so the parent has to exist regardless of how long the decode takes.Closes Issue(s)
Closes #25397
How to test
Automated: three Playwright specs in
whiteboard/slideChangeBlank.ts— no blank on a cold slide change (this one fails on the old code), broken asset degrades without hanging, and a viewer following a slide change that arrives while its camera is still calibrating.More