[Live] Fixing lost behavior of handling element with an action and a model on it #1572
+40 −0
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.
UPDATE
I think this fix is not needed at all - I think #1557 happened just due to the "gotcha" listed below. If you fix that, things DO work... and we even have a test for this :). I've reverted my fix... this is now just a docs PR.
This is old behavior that we once had, but got lost in a reshuffle of code a long time ago. It's an edge case. Imagine:
This element is both bound to a
countmodel and should trigger an action. Due to how the events are registered, here is the natural order:action()is triggeredThe result is that the
doSomethingLiveActionis triggered... but without the updatedcountvalue. Our fix is to detect this situation and add a slightly delay (waiting for the potential model update) before triggering the action.There is one gotcha that will need to be documented: if you (1) trigger the model update on
changebut trigger the action oninput, then the action fires quite a bit before the model is updated onchange. This is a misconfiguration, but easy to do with the form system, sincechangeis the default, but any customdata-actionon an input will default to theinputevent.TODO
Add tests