fix(calendar): persist view mode and current date on every mutation #26

Merged
AhmedHanafy725 merged 1 commit from development_calendar_view_persistence into development 2026-04-21 11:56:45 +00:00
Member

Summary

Fix calendar view mode / date not surviving reload. Previously only the double-click cycle called WhiteboardSync.onUpdate; the properties panel selector, Prev/Today/Next buttons, and in-header nav arrows mutated local state silently.

Closes #25

Changes

  • crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.js
    • navigateNext, navigatePrev, cycleViewMode, and navigateCalendar now call WhiteboardSync.onUpdate(group) after redrawing. Covers both the properties-panel Prev/Next buttons (which go through these helpers) and the in-header arrow clicks.
  • crates/hero_whiteboard_ui/static/web/js/whiteboard/properties.js
    • prop-cal-viewmode change handler and prop-cal-today click handler now call WhiteboardSync.onUpdate(currentNode) after mutating _calState.

Test Results

  • cargo check --workspace: pass
  • cargo clippy --workspace -- -D warnings: pass
  • cargo fmt --check: pass

Changes are vanilla JS; manual UI verification needed.

Manual verification

  • Change view mode in the properties panel, reload — calendar comes back in the selected view.
  • Navigate Prev/Next/Today via the properties panel, reload — date is preserved.
  • Click the in-header nav arrows, reload — date is preserved.
  • Double-click cycle still works and persists (unchanged behavior).
## Summary Fix calendar view mode / date not surviving reload. Previously only the double-click cycle called `WhiteboardSync.onUpdate`; the properties panel selector, Prev/Today/Next buttons, and in-header nav arrows mutated local state silently. ## Related Issue Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/25 ## Changes - `crates/hero_whiteboard_ui/static/web/js/whiteboard/calendar.js` - `navigateNext`, `navigatePrev`, `cycleViewMode`, and `navigateCalendar` now call `WhiteboardSync.onUpdate(group)` after redrawing. Covers both the properties-panel Prev/Next buttons (which go through these helpers) and the in-header arrow clicks. - `crates/hero_whiteboard_ui/static/web/js/whiteboard/properties.js` - `prop-cal-viewmode` change handler and `prop-cal-today` click handler now call `WhiteboardSync.onUpdate(currentNode)` after mutating `_calState`. ## Test Results - `cargo check --workspace`: pass - `cargo clippy --workspace -- -D warnings`: pass - `cargo fmt --check`: pass Changes are vanilla JS; manual UI verification needed. ## Manual verification - [ ] Change view mode in the properties panel, reload — calendar comes back in the selected view. - [ ] Navigate Prev/Next/Today via the properties panel, reload — date is preserved. - [ ] Click the in-header nav arrows, reload — date is preserved. - [ ] Double-click cycle still works and persists (unchanged behavior).
fix(calendar): persist view mode and current date on every mutation
All checks were successful
CI / build (pull_request) Successful in 2m8s
2806e38f8c
Previously only the double-click handler called WhiteboardSync.onUpdate,
so changing the view via the properties panel selector, pressing Prev /
Today / Next, or clicking the in-header nav arrows mutated local state
and redrew the calendar but never reached the server. After reload the
calendar reverted to the default month view on today's date.

Call WhiteboardSync.onUpdate from every mutation path:
- calendar.js: navigateNext, navigatePrev, cycleViewMode, navigateCalendar
- properties.js: prop-cal-viewmode change, prop-cal-today click
(prop-cal-prev / prop-cal-next go through navigatePrev / navigateNext
so they piggy-back on those fixes.)

#25
AhmedHanafy725 merged commit 221362c7b0 into development 2026-04-21 11:56:45 +00:00
AhmedHanafy725 deleted branch development_calendar_view_persistence 2026-04-21 11:56:49 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_whiteboard!26
No description provided.