Issue with formie and blitz
Describe the bug
Hi
We have found an issue with formie and blitz
I added the following code to my project to prevent blitz from caching user data:
{% do craft.formie.setCurrentSubmission(form, null) %}
If the user reloads the page to start over without completing his first submission and clicks on next, he ends up on the next page from his old submission. (Check steps to reproduce)
Can you add this to #2001
Best regards
Steps to reproduce
- Install blitz
- Enable it
- Import this form formie-contact.json
- Add the form to a page
- Add this code to ensure no submission data will be rendered and cached by blitz
{% do craft.formie.setCurrentSubmission(form, null) %} - Ensure the page is cached (check for comment Cached by Blitz ...)
- Open the page in a private browser
- Click next to go to page 2
- Reload the page, you are back to page 1 and the form is empty as expected
- Click next, you are now on page 3
Form settings
- Multi-page form: Yes
- Submission Method: Ajax
- Custom Form Templates: No
Craft CMS version
4.11.1
Plugin version
2.1.24
Multi-site?
No
Additional context
Blitz: 4.22.0
This is a little tricky with Blitz, as if you have server rewrites setup, it's never going to even hit Craft/Formie to run this Twig code. I'm not sure if you have that enabled yet.
Otherwise, this is going to behave as I'd expect with a static cache. If the entire page is cached, this Twig code isn't going to run every time.
But as for the session data, that's not going to be cached, being a POST request, so it's likely to get out of sync.
As you mentioned, with this issue we're going to need to come up with an all-encompassing way to handle statically-cached sites, including changing session-handling behaviour.
Thanks for your feedback I hope that a solution can be found.