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

Default successHook on forms #22

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

andjsch
Copy link
Contributor

@andjsch andjsch commented Jul 4, 2024

This PR moves the setTimeout() function into the successHook() method which allow for it to be overridden or skipped, depending on what you pass into the success_hook parameter of the partial.

If something is passed without a return statement, the setTimeout() will still be called, executing additional features before it. Passing something with a return statement, skips the setTimeout() completely.

Closes studio1902/statamic-peak#393

Changes proposed in this pull request:

  • Moved the setTimeout() function into the successHook() method

@robdekort
Copy link
Contributor

Nice. Also appreciate discussing this first. Awesome. Any chance you want to update the docs as well?

@robdekort robdekort merged commit 631b12c into studio1902:main Jul 4, 2024
@robdekort
Copy link
Contributor

Seems to work like a charm. Thank you!

@andjsch
Copy link
Contributor Author

andjsch commented Jul 4, 2024

Happy to be able to contribute to your awesome work!

@andjsch
Copy link
Contributor Author

andjsch commented Jul 4, 2024

Nice. Also appreciate discussing this first. Awesome. Any chance you want to update the docs as well?

Sure. I'll add it to my to-do for tomorrow!

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.

[PR pre-approval] Default success hook on forms
2 participants