omsn2 opened a new pull request, #43108:
URL: https://github.com/apache/superset/pull/43108
### SUMMARY
Native filter selections were lost whenever users navigated away from a
dashboard
and returned via normal Superset navigation (menu, dashboard list,
bookmarks, fresh tab).
Filter state was only recoverable if the exact URL containing
`native_filters_key`
was manually preserved — making repeated daily analysis frustrating.
This fix adds lightweight client-side persistence using `localStorage`:
- On every filter change, saves the full `dataMask` to `localStorage` keyed
by `dashboardId`
- On dashboard load, if no `permalinkKey` or `nativeFiltersKey` is present
in the URL,
falls back to the last saved state from `localStorage`
- Uses `hydratedDashboardId === id` guard (Redux-driven) instead of a
`useRef` flag to
prevent writing one dashboard's filter state under another dashboard's key
during
SPA navigation between dashboards
Fixes #43057
### BEFORE / AFTER SCREENSHOTS
**Before:** Filters reset to configured defaults every time a user navigated
away
and returned via the normal Superset UI.
**After:** Filters are automatically restored from the user's last applied
state on
every subsequent visit, without requiring URL preservation.
### TESTING INSTRUCTIONS
1. Open any dashboard that has native filters configured
2. Apply one or more filter values (e.g. select a country, date range, etc.)
3. Navigate away via the top Superset menu (e.g. Dashboards list)
4. Click back into the same dashboard from the list
5. ✅ Verify: filters are restored to the previously applied values
automatically
### ADDITIONAL INFORMATION
**Known limitations (acknowledged in the linked issue):**
- Per-browser only — does not sync across devices or browsers
- No per-user scoping — on a shared browser profile, one user's filters may
appear for another user of the same browser
- No TTL or invalidation — stale saved filters may persist if an admin
changes filter configuration or defaults
A server-side approach (e.g. `last_filter_state` per user+dashboard) would
address
these gaps but is out of scope for this lightweight client-side fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]