Skip to content

Fix(show/edit): Avoid a redirect loop when useGetOne returns an error in shadcn-admin-kit#10776

Merged
djhi merged 2 commits intomasterfrom
fix/edit-redirect-loop
Jun 11, 2025
Merged

Fix(show/edit): Avoid a redirect loop when useGetOne returns an error in shadcn-admin-kit#10776
djhi merged 2 commits intomasterfrom
fix/edit-redirect-loop

Conversation

@jonathanarnault
Copy link
Copy Markdown
Contributor

@jonathanarnault jonathanarnault commented Jun 10, 2025

Problem

When a resource is not found in shadcn-admin-kit, there is an infinite loop caused by a race condition between the router navigation and the query refresh

Solution

Flush sync the navigation in useEditController and useShowController when the record fails to be retrieved.

How To Test

Perform the test in the shadcn-admin-kit with the updated code

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@djhi djhi merged commit b8d1878 into master Jun 11, 2025
15 checks passed
@djhi djhi deleted the fix/edit-redirect-loop branch June 11, 2025 06:57
@djhi djhi added this to the 5.8.4 milestone Jun 11, 2025
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.

2 participants