-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 case where we would omit the ref from reused vnodes #3696
Conversation
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Results02_replace1k
duration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
03_update10th1k_x16
duration
usedJSHeapSize
07_create10k
duration
usedJSHeapSize
filter_list
duration
usedJSHeapSize
hydrate1k
duration
usedJSHeapSize
many_updates
duration
usedJSHeapSize
text_update
duration
usedJSHeapSize
|
Size Change: +27 B (0%) Total Size: 44 kB
ℹ️ View Unchanged
|
test/browser/refs.test.js
Outdated
render(<App count={0} />, scratch); | ||
expect(calls[0]).to.equal(scratch.firstChild.firstChild); | ||
render(<App count={1} />, scratch); | ||
expect(calls[1]).to.equal(null); |
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.
this seems to still be called in the wrong order for functions i.e. applyRef(null); applyRef(element);
This could be similar to v11 ref ordering #3493 i.e. we basically unmount the parent but have already applied the ref as part of the diff in the child - this could be because our equality logic falls apart as we have no oldVNode to match against
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.
Really good find 🙌
fixes #3695
I think this should be a safe change as the ref from a reused element i.e.
const x = <div ref={ref}>
will always point at the same ref