-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Actions: auto-redirect action response to avoid "confirm form resubmission" dialog #11603
Conversation
🦋 Changeset detectedLatest commit: 699ec2b The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
37b2823
to
c4130c7
Compare
0496de4
to
7db24bb
Compare
80ab841
to
7ee9b0c
Compare
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.
The code looks good to me. I suppose we want to wait for the docs change before merging?
@bholmesdev is there a chapter in the RFC I can look at before reviewing the code? |
@ematipico Thanks for flagging that! I just finished a new guide on the RFC docs: https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md#call-actions-from-an-html-form Writing out examples actually helped me find a design flaw. I decided the cookie should not be cleared on success. Otherwise, the action result data would disappear on a refresh. |
Changes
This change adds automatic redirects when an action is called. This follows Laravel's POST/redirect/GET pattern to avoid a "confirm form resubmission" dialog and remove the
?_astroAction
param from the rendered result.See the changeset for usage instructions.
url.pathname
on success.getActionResult
with the cookie JSON. Delete after the request has been fulfilled.Testing
Update integration tests to follow an expected redirect.
Docs
Updated RFC docs with new guide: https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md#call-actions-from-an-html-form