Warning: window.reload() can do form submits

Created on 21 July 2023, over 1 year ago
Updated 18 March 2024, 8 months ago

This is not necessarily an issue with this module and the PageReloadCommand that it implements (thank you by the way!!!).

I just want to drop this note here incase someone is pulling out their hair like I just was.

It turns out the the JavaScript function that this module uses, window.reload(), will quietly do a form submit if the form submit was the last thing the browser window did before the reload() function was called.

So I think this module is doing the right thing, but folks should be careful if they are expecting to update form values in a modal, and then expecting the form to display the new values after responding with PageReloadCommand. In our case, with a multi page webform, the form was being resubmitted and replacing our modified values.

We ended up writing our own custom CleanPageReloadCommand that just does window.location.replace(window.location.pathname). I'm not suggesting this module needs to change. Just leaving this hear in case it helps someone else.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States JonMcL Brooklyn, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024