- Issue created by @breidert
- First commit to issue fork.
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
I proposed this on slack. I'm working on it.
- Merge request !20Issue #3494453: Only save forms if the browser window is visible β (Open) created by penyaskito
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
There's no way to create automatic test this. Hopefully we will adopt Playwright ( π Consider dropping Nightwatch in favor of Functional Javascript tests Active ) that allows to use several sessions/tabs.
For manually testing, configure autosave_form for nodes, go to edit a node, execute
ddev . tail -f /var/log/nginx/access.log
while playing with tab active/unactive. - πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
I can't see any reason this should be optional at all. But if maintainers disagree, could be based on a setting.
- π©πͺGermany breidert
I am not sure if the approach is safe.
If you switch windows before the next save interval (e.g. 60s), then your form is not saved.
I think that you should first stop saving, if the document has been hidden longer than the interval. Then you are sure that the last change was saved.
- πͺπΈSpain penyaskito Seville π, Spain πͺπΈ, UTC+2 πͺπΊ
That makes a lot of sense.
- π©πͺGermany rvolk Frankfurt
I like to recommend to also implement a checksum of the form values. If the checksum didn't change since the last safe event, we don't need to submit the request to the backend.
For performance reasons the safe event should be triggered with the onchange event, plus on an interval when the user is active in the current window (e.g. typing in a long textarea doesn't trigger the onchange event unless the focus leaves the field, so we need to do it in a timely manner while he's typing). When the safe event is triggered, it must compare the checksum of the current form with the last submitted checksum. If the checksum didn't change, the safe request can be skipped. This would have the benefit to work with an active and inactive window, enhancing the proposed behaviour with an additional reduction of network load, avoiding to submit unchanged content.
Once implemented, this makes the experimental feature "Run only on form change" obsolete.
- π©πͺGermany hchonov πͺπΊπ©πͺπ§π¬
I want to bring the attention also to π "Experimental" autosave on form change is enabled, but doesn't work. Active . Maybe if the experimental features gets working we do not need other features to prevent unnecessary submissions?