Skip to content

Fix PrevNextButtons store opt-out - #11372

Closed
lprnmns wants to merge 1 commit into
marmelab:masterfrom
lprnmns:codex/fix-prev-next-store-key-false
Closed

lprnmns wants to merge 1 commit into
marmelab:masterfrom
lprnmns:codex/fix-prev-next-store-key-false

Conversation

@lprnmns

@lprnmns lprnmns commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Problem

<PrevNextButtons storeKey={false}> still reads the resource's stored list parameters. Stored filters leak into its getList request and stored sorting overrides the explicit sort prop, despite false being documented as disabling the stored configuration.

Fixes #11370.

Solution

Keep the unconditional useStore call required by React hooks, but use the props-derived defaults when storeKey is false. This mirrors the existing useListParams opt-out behavior and keeps cache lookup and fetching on the same parameters.

How To Test

yarn test-unit-ci packages/ra-core/src/controller/usePrevNextController.spec.tsx packages/ra-ui-materialui/src/button/PrevNextButtons.spec.tsx
yarn workspace ra-core build
yarn exec eslint packages/ra-core/src/controller/usePrevNextController.ts packages/ra-core/src/controller/usePrevNextController.spec.tsx
yarn exec prettier --check packages/ra-core/src/controller/usePrevNextController.ts packages/ra-core/src/controller/usePrevNextController.spec.tsx

The regression test initializes posts.listParams with a stored filter and descending sort, then verifies that storeKey={false} uses only the explicit filter and ascending sort.

Additional Checks

  • The PR targets master for a bugfix
  • The PR includes unit tests
  • A story was not added because the regression is at the controller/store boundary and is covered directly
  • Existing documentation already describes false as disabling the stored configuration

@fzaninotto

Copy link
Copy Markdown
Member

a similar patch has already been proposed in #11371, closing this one as duplicate

@fzaninotto fzaninotto closed this Sep 14, 2026
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.

<PrevNextButtons storeKey={false}> has no effect

2 participants