Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: refresh=true query params in not handled properly on the show page #1708

Open
louisGRS opened this issue Aug 27, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@louisGRS
Copy link

Contact Details

No response

What happened?

Hi !
Thank you for your work on adminJS, it's really a great timesaver for us ✨🙏

TL;DR: browsing to /admin/resources/Patient/records/3324d28c-4575-4c73-875b-6d787ed1ff6e/show?refresh=true makes the ActionHeader behaves as if it was currently on the list page

I'm currently trying to change the redirection behavior after editing a resource through the edit page. The default redirection behavior is to redirect to the list page. I would like to redirect to the show page instead.

To achieve this, I've setup an after hook on the edit action to set the correct redirectUrl on the response (for example: /admin/resources/Patient/records/3324d28c-4575-4c73-875b-6d787ed1ff6e/show). This part works well and I can see the correct redirectUrl in the POST edit response request when checking the network.

After this, the client does not follow this redirection directly. It automatically appends a refresh=true query params on the redirectUrl and finally navigates to this final url (/admin/resources/Patient/records/3324d28c-4575-4c73-875b-6d787ed1ff6e/show?refresh=true). I don't mind having this extra query param because it still allows my client to be redirected to the show page.

The page displays as intended, except for the ActionHeader. I have a custom ActionHeader setup on my application, so I don't know if it can affects the behavior. The problem I have is that my ActionHeader behaves as if the current page was the list page (.i.e I have different buttons in my ActionHeader on the show page and the list page). When I break into my ActionHeader and check the values passed by adminJS, I can see that these values are the same as the list page. The 'action' value for example is set to 'list'.

I don't know the code behind this in the adminJS core, but it looks like the presence of the refresh=true params on the show page prevents the front app from correctly understanding the current action.

We would appreciate it very much if you could help us with this issue ! ☀️

Bug prevalence

Always

AdminJS dependencies version

"adminjs": "^7.7.2",
"@adminjs/design-system": "^4.1.1",
"@adminjs/fastify": "^4.1.0",
"@adminjs/relations": "^1.1.2",
"@adminjs/themes": "^1.0.1",
"@adminjs/typeorm": "^5.0.0",

What browsers do you see the problem on?

Chrome

Relevant log output

No response

Relevant code that's giving you issues

No response

@louisGRS louisGRS added the bug Something isn't working label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant