-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
(feat) - short-circuit diffing #1538
Conversation
Can't seem to find the right approach for #1322 since the wrapper should bail out of rendering but it might send out something to Providers or? The hard part is that when we are setting state we call diff with old and new set on the same entity which makes it kind off hard to do checks on this. I've put this up to review with the test for 1322 skipped and 1398 being a success. I will handle 1322 in a seperate PR when I've gained more insight in this (or if anyone could give me a pointer would also be welcome). |
Will try and debug this tomorrow... It seems that something broke because of the merge, _original and current seem to lose equality again My guess is this: https://github.com/developit/preact/pull/1440/files#diff-a04f8653407a342eac2cd2ea6a5c3ff6R166 this could cause a double coercion |
I'm really struggling to find a reasoning when to short-circuit on setState and when not to. We could do a check if arguments are supplied or its just an empty object but it feels odd to even instantiate diffing for that. Is it just to activate a trickle-effect or? Someone that can shed more light on the use case of: #1322 ? |
Hmm again errors after updating the branch, I'll leave this feature as it is until we get back to it. |
So apparently something changed and when it bubbles it's considered equal now, this gets fixed by changing this line |
Libraries like redux and other state management libraries rely on this to propagate state changes.
Initial problem being that we pass the current vnode as old and new vnode on setState, this is logical but limits us in certain aspects for this case.
tests: #1322
Fixes: #1398 (This works now)
Adds:
1514Bytes to the main package