-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hold sync during set_state? #2259
Comments
To fill in some things we considered during the meeting: |
I did not include this in the issue as I forgot that backbone actually sets all the attributes before any events are triggered. As such, this workaround should not do anything. |
Also: The fix for the selection widgets should be used anyways, as all widgets should deal with |
While reviewing #2256, I considered that maybe a more elegant solution would be to use
hold_sync
when setting the state from an update message. This would ensure that any new state changes as a direct response to the update (i.e. synchronous changes from validators or observers) all get collapsed into a single update message to the frontend. This collapsed update could then be verified against the property lock simplifying the logic.A possible problem is that if multiple attributes change, then there is a potential for a change in the order of JS-side change notifications. For example:
{foo: 5}
, then{bar: 1}
. This would trigger thechange:foo
andchange
events on the JS side first, with only foo updated. Thenchange:bar
andchange
with bar updated.{foo: 5, bar: 1}
. This triggerschange:foo
andchange:bar
in undefined order, then a singlechange
event, all with both foo and bar updated.This could potentially be an issue for selections, e.g. here. In this case, the view-code would need to always update the options and index in the same go, using
hasChanged
to confirm e.g. like this:The text was updated successfully, but these errors were encountered: