Skip to content

Syncing missing filter/localParams state with URL on list load #11018

@ayoubice

Description

@ayoubice

Summary

When loading a List page, react-admin reads filter and list params from the store (localParams), but does not automatically sync missing params back to the URL if they aren't present. This can lead to a desynchronization between persisted state and browser address, causing navigation inconsistencies and confusion.

Expected Behavior

  • If state parameters (filters, page, sort, etc.) are present in localParams/store but not in the URL, the application should update the URL with these parameters to ensure consistency.

Actual Behavior

  • The current behavior merges params from the URL and store, but does not update the browser location when the URL is missing parameters. This means users can land on a list in a state that isn't reflected in the URL, making it hard to share or bookmark their current state, and breaking expected navigation (such as back/forward).

Steps to Reproduce

  1. Open a List with filters or custom params persisted in the store.
  2. Remove params from the URL (e.g. by direct navigation or clearing query string).
  3. Observe that the page loads with state from store, but the URL does not reflect the current filter/page/sort.
  4. Bookmarking or refreshing can result in confusion.

Discussion Topics / Proposal

  • Should there be an option to always sync missing params from localParams/store into the URL?
  • What are the best practices for keeping store and URL state consistent for navigation, sharing, and bookmarking?


Environment

  • React-admin version: Current (v4/v5)
  • React version: 17/18
  • Browser: All

This thread is meant to gather community feedback and solutions, as well as potential workarounds. Any insight from the maintainers on the reasoning and recommended patterns is highly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions