Skip to content

fix(html5): prevent white flash on slide change - #25493

Merged
ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-developfrom
Tainan404:fix/slide-change-blank-flash-25397
Jul 23, 2026
Merged

ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-developfrom
Tainan404:fix/slide-change-blank-flash-25397

Conversation

@Tainan404

Copy link
Copy Markdown
Member

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 called setCurrentPage before the SVG had been fetched — and CSS paints nothing for a background-image whose 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 an Image.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

  1. Join as presenter with a multi-slide presentation, with the cache disabled (DevTools → Network → Disable cache) and some throttling — that's what makes the flash visible.
  2. Jump forward past the prefetch window (slide 1 → 9), then navigate backwards.
  3. The previous slide should stay visible until the new one paints — no white canvas in between.
  4. Worth also checking: rapid navigation (1 → 9 → 3) should settle on slide 3, and changing slides while editing a text shape should not crash (issue 25332).

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

  • Known limitation: if the background takes longer than the timeout, the fallback fires and the original flash still shows. The gate covers the common near-cache case, not the worst one.
  • The timeout is deliberately short because the toolbar, zoom and camera are not gated — a long wait would leave them showing a slide the canvas hasn't caught up to yet.
  • Making the slide SVG properly browser-cacheable, so the decode prime warms the cache tldraw later reuses, is a separate PR (Few fixes for the bbb-lti module #71) — it carries an authorization tradeoff on the cache lifetime that deserves its own review.

imdt-claudiop and others added 4 commits July 21, 2026 12:00
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.
@coderabbitai

coderabbitai Bot commented Jul 22, 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: Pro

Run ID: c77d4ed7-71f2-4c41-9403-7465cc88ffdd

📥 Commits

Reviewing files that changed from the base of the PR and between c963ec3 and 4f08786.

📒 Files selected for processing (6)
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
  • bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts
  • bigbluebutton-html5/private/config/settings.yml
  • bigbluebutton-tests/playwright/whiteboard/slideChangeBlank.ts
  • bigbluebutton-tests/playwright/whiteboard/whiteboard.spec.ts

Walkthrough

Whiteboard 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 slideSwapDecodeTimeoutMs setting defaults to 250 ms. Playwright coverage tests delayed delivery, broken assets, and viewer navigation during mounting.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested reviewers: imdt-claudiop, gustavotrott, ramonlsouza

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main user-facing fix: preventing the white flash on slide changes.
Description check ✅ Passed The description matches the changeset and explains the decode-gated slide swap and related tests.
Linked Issues check ✅ Passed The PR satisfies #25397 by gating the client-side slide swap until the SVG is ready to paint, even under slow or uncached loads.
Out of Scope Changes check ✅ Passed The added config, type updates, component changes, and Playwright tests all support the slide-flash fix and do not appear unrelated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

@antobinary antobinary added this to the Release 3.0 milestone Jul 22, 2026
@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@ramonlsouza
ramonlsouza self-requested a review July 23, 2026 18:20
@ramonlsouza
ramonlsouza merged commit a5e2c16 into bigbluebutton:v3.0.x-develop Jul 23, 2026
35 checks passed
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.

Client: slide area renders blank after slide navigation until the slide SVG loads (tldraw background asset race)

4 participants