Keep holidays/Hebrew-date overlays when changing year - #3
Merged
Conversation
changeYear/changeRange preserved the `calendars` URL param verbatim, so a year change that fired before the toggle's URL update had committed would drop the overlays (they only stuck on the second toggle, once the URL caught up). Rebuild `calendars` from component state (visibleCalendarIds + the two toggle flags) in both, matching the toggle handlers — the URL is no longer trusted as the source of truth. Adds a regression test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Enable the holidays + Hebrew-date overlays, then click a year arrow → the overlays vanish. They only persist if you toggle them a second time before navigating.
Cause
changeYear/changeRangepreserved thecalendarsURL param as-is. When the year change fired before the toggle'srouter.pushhad committed the new URL, the read-backcalendarswas stale (missing the overlays), so they were dropped. On the second toggle the URL had caught up, so it worked.Fix
Rebuild
calendarsfrom component state (visibleCalendarIds + the two toggle flags) inchangeYearandchangeRange, exactly like the toggle handlers — the URL is no longer the source of truth. + regression test.Verification
npm test→ 70 passing (incl. new "rebuild overlays from state over a stale URL" regression)npm run build→ green🤖 Generated with Claude Code