-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix reactivity for non-primitives #418
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there are a couple of things:
- The example you posted on Slack is, in my opinion, incorrect. I never thought that
ReactiveVar#set
will trigger when I set the exact same non-primitive value in there. I see it's documented, but that's at least unexpected. - This code can be simplified in two steps:
- Replace
undefined
with{ value: undefined }
innew ReactiveVar
inBlaze._attachBindingsToView
. - Change
x && y ? x.error === y.error && x.value === y.value : x === y
toReactiveVar._isEqual(x.error, y.error) && ReactiveVar._isEqual(x.value, y.value)
.
- Replace
- We should add a test for that (maybe in a subsequent PR).
- We should copy the example from Slack to here, as otherwise it'll disappear in 3 months.
Incorrect in terms of that nested reactivity doesn't really exist with ReactiveVar? Then yes, it should be renamed to "fix reactivity for non-primitives"
I can add this to the PR
I can also add a test to this PR, I think it should not be that much additional effort
The example is already in the referenced issue #418 |
Well, yes, changing the name is fine. My thought was that I find it unintuitive that there's more logic than
Great, thank you!
That would be awesome.
Yeah, my bad, I checked the notifications in the reversed order. |
tests need to be updated 🤔 |
Yes, I think the latest commit broke things. I'll check later and update. |
The tests started failing after I changed view._scopeBindings[name] = new ReactiveVar({ value: undefined }, _isEqualBinding); it seems that at some other places the scope binding is not expecting this structure, mainly in all async tests. I can check if we can fix this, however, I would propose to revert to the previous commit, which worked stable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that at some other places the scope binding is not expecting this structure, mainly in all async tests. I can check if we can fix this, however, I would propose to revert to the previous commit, which worked stable.
I think it's something different, but this can be handled later. Let's ship this fix!
If everyone is on board! will launch this patch |
@Grubba27 go for it 👍 |
Blaze & spacebars are out 🚀 |
This fixes #417 to make nested data reactive again