Ignore inner updates on a stimulus-reflex action or turbo submit#174
Merged
julianrubisch merged 3 commits intostimulusreflex:masterfrom Jan 6, 2022
Merged
Conversation
leastbad
reviewed
Jan 5, 2022
Contributor
leastbad
left a comment
There was a problem hiding this comment.
I sincerely hope that this is the last hairy edge case, for our sanity.
Anyhow: LGTM, moderated to a really liberal definition of "good" - I wish it wasn't necessary, but I agree with you that it is, and very much appreciate that you have championed getting this done properly.
5ce6474 to
9a53dec
Compare
9a53dec to
3abc8d7
Compare
marcoroth
approved these changes
Jan 6, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let me preface this PR with the fact that this is already being used successfully in production and is intended as a backmerge of the work I'm doing at https://github.com/code-and-co/.
The idea is to opt out of an
updates_foroperation for the current user on a per-element basis, when a reflex or turbo submit is happening (for example, when wrapping a<turbo-frame>).Conceptually, it consists of 3 parts:
javascript/updatable/inner_updates_compat.js
which recursively marks every enclosing
updates-forelement withperforming-inner-update, starting from a reflex or turbo submit initiating element. This attribute is removed again after completion.An
ignore_inner_updateoption added to the helperwhich adds a
ignore-inner-updateattribute to the element on demand.A shouldUpdate mechanism
combining the existing "only" option and returning early when both
ignore-inner-updatesandperforming-inner-updateare set on an element.cc @andrewerlanger @assuntaw