-
Notifications
You must be signed in to change notification settings - Fork 206
Fix back button after form submit #2066
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
base: master
Are you sure you want to change the base?
Conversation
AFAICT this change has no effect on the issue. From how I read the code, I tried adding some logging to see whether Did the issue disappear in your testing with this patch? |
Sorry, I thought I had fixed it, but re-checking it didn't. Let me try again. |
(My assumption is that after the form redirect, the new page isn't registered on the |
With Bugwith-bug-Peek.2025-05-05.19-27.mp4With PRPeek.2025-05-05.19-26.mp4 |
OMG this seems to actually work :-D I have to test it more extensively, but it seems like this does the trick. I wonder what the reason was for replaceState instead of pushState there in the first place – could there be some difference between submitting and staying in the same url (except query parameters?) vs submitting and redirecting to a new url? |
Hopefully @mpscholten will remember 😄 |
@@ -211,11 +186,11 @@ window.submitForm = function (form, possibleClickedButton) { | |||
); | |||
transitionToNewPage(request.response); | |||
Turbolinks.clearCache(); | |||
if (urlPathnameWithQuery !== formAction) { | |||
|
|||
if (urlPathnameWithQuery !== formAction || urlPathnameWithQuery !== responseUrlPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix for the back button
fixes #2063
initBack
which seems no longer used (?)initDisableButtonsOnSubmit
to use a better way to prevent double binding@unhammer could you try this PR locally to confirm it works for you?