firebase / firebase/friendlyeats-web

Wrong filter state on backward navigation

Open
#340 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
597
Forks
456
PR merge metrics
No merged PRs in 30d

Description

When using the browser's back navigation, the filter state becomes desynchronized from the URL parameters. The UI shows outdated filter values while the URL contains the correct ones.

### Steps to Reproduce
1. Apply filters using the filter component (e.g., set city to "New York")
2. Use browser's back button
3. Observe that filter UI doesn't match URL parameters

### Expected Behavior
Filter state should always be synchronized with URL search parameters, including during browser navigation.

### Root Cause
The component uses React state for filters that doesn't get updated when URL changes via browser navigation. The `useState(initialFilters)` only uses the initial value on first render.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.