Viewer / presentation share opens with default theme instead of board theme #114
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#114
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
When a viewer joins a board through a shared link (with or without
?present=1), the page loads with the default light theme regardless of what theme the owner has applied. If the owner changes the theme while the viewer is already on the page, the change syncs live and renders correctly — only the initial load is wrong.Steps to reproduce
?present=1.Expected
The viewer tab loads with the owner's chosen theme.
Actual
The viewer tab loads in the default light theme. If the owner then re-applies the same theme, the viewer tab updates instantly. So the live-sync path works; only the initial load is broken.
Root cause (already pinpointed)
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js::loadBoardgates initial theme loading on!readonlyMode:The viewer template (
board_view.html) initializes with{ readonly: true }, so the theme is silently skipped. The live-update path insync.js::handleWsMessage(board.theme.updated) does not checkreadonlyMode, which is why a change applies but the initial load doesn't.Fix
Remove the
!readonlyModegate. Theme is a presentation-only concern — it makes no sense to skip it for read-only viewers.Implementation Spec for Issue #114
Objective
Viewer / presentation-share tabs must load the board's theme on initial render, not just pick it up if the owner re-applies it after the page is already open.
Root cause (already located)
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js::loadBoardgates the initial theme load on!readonlyMode:The viewer template (
board_view.html) callsWhiteboardApp.init(_boardId, { readonly: true }), so the theme load is silently skipped on first render. The live-update path insync.js::handleWsMessageforboard.theme.updateddoesn't checkreadonlyMode, which is why a subsequent owner-side change applies but the initial load doesn't.Requirements
board.html) initial load — it already worked.boardData.theme— they still fall through to defaults.Files to Modify
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js— drop&& !readonlyModefrom the initial-load theme branch inloadBoard.Implementation Plan
Step 1: Apply theme on initial load regardless of read/write mode
File:
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.jsChange:
to:
That's the entire fix.
WhiteboardThemes.loadThemealready handles_fromSync-style behavior cleanly via the same code path (parsescustomCSS, registers it undercustomThemes[name], and re-applies CSS variables to the DOM); calling it on initial load in readonly mode is exactly what we want.Dependencies: none.
Acceptance Criteria
?present=1— same: presentation tab loads with the correct theme./board/<id>— unchanged.cargo fmt,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --libclean.Notes
themes.js::init) is built into the navbar, which is hidden inboard_view.htmlvia existing CSS — so the viewer still has no way to change the theme. We're only fixing the display of the owner's chosen theme.Test Results
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace --lib— 0 failednode --check app.js— cleanImplementation Summary
One-line surgical fix: drop the
!readonlyModegate from initial theme loading inapp.js.Root cause
WhiteboardApp.loadBoardwas skipping the theme load on initial render whenever the page was opened with{ readonly: true }, which is exactly the case forboard_view.html(viewer share + presentation share). The live-update path insync.js::handleWsMessageforboard.theme.updatedwas not gated, which is why a change applied but the initial load did not.crates/hero_whiteboard_ui/static/web/js/whiteboard/app.jsFiles Changed
crates/hero_whiteboard_ui/static/web/js/whiteboard/app.js—+1/-1Test Results
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace --lib— 0 failednode --check app.js— cleanManual smoke
?present=1— presentation tab loads with the correct theme./board/<id>— unchanged.Notes
board_view.htmlvia existing CSS. The viewer still has no way to change the theme — we only fixed displaying the owner's chosen theme.