Skip to content

Conversation

@rchlfryn
Copy link
Collaborator

@rchlfryn rchlfryn commented Feb 10, 2026

Description

Fixes a race condition in WidgetRouterHandler that caused the widget to get stuck at #/all during zone-date-zone navigation. The issue occurred when useHash's setTimeout-delayed state captured intermediate widget routing states instead of the final hash value we wanted

Related Issues

Fixes #918

Key Changes

WidgetRouterHandler.client.tsx:

  • Changed to read window.location.hash directly instead of using observedHash state
  • observedHash still triggers the effect when hash changes, but we always read the current hash value
  • This ensures validation happens against the actual current hash, not a stale React state value

How to test

  1. Navigate to any zone forecast page (e.g., /forecasts/avalanche/olympics)
  2. Use the date navigation in the widget to view previous/next forecasts
  3. Navigate to a different zone forecast page
  4. Expected: Smooth navigation between zones and display selected zone information
  5. Bug (before fix): Widget would load all forecast information at #/all while URL showed correct place

Also test:

  • Zone-to-zone navigation still works
  • Initial page load sets correct hash
  • No infinite loops or console errors

Screenshots / Demo video

https://www.loom.com/share/d0b89b8ff5774699b0e5294381742ffe

@rchlfryn rchlfryn changed the title Remove race case happening when has is changed Remove race case happening when hash is changed Feb 10, 2026
@rchlfryn rchlfryn changed the title Remove race case happening when hash is changed Fix: prevent widget getting stuck at #/all when navigating forecast dates Feb 10, 2026
@rchlfryn rchlfryn changed the title Fix: prevent widget getting stuck at #/all when navigating forecast dates Fix: prevent widget getting stuck at #/all when navigating forecast dates Feb 10, 2026
@github-actions
Copy link

Preview deployment: https://bug-avy-forecast-nav.preview.avy-fx.org

@rchlfryn rchlfryn self-assigned this Feb 11, 2026
@rchlfryn rchlfryn added this pull request to the merge queue Feb 11, 2026
Merged via the queue into main with commit dd2de4e Feb 11, 2026
8 checks passed
@rchlfryn rchlfryn deleted the bug-avy-forecast-nav branch February 11, 2026 18:36
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.

Avalanche Forecast Navigation When Viewing Past Forecasts

1 participant