Skip to content
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) - scu without children #1888

Merged
merged 12 commits into from
Sep 5, 2019
Merged

(fix) - scu without children #1888

merged 12 commits into from
Sep 5, 2019

Conversation

JoviDeCroock
Copy link
Member

No description provided.

@coveralls
Copy link

coveralls commented Aug 19, 2019

Coverage Status

Coverage increased (+0.1%) to 99.881% when pulling 9a8859c on fix/noSiblings into 7345fe8 on master.

@JoviDeCroock
Copy link
Member Author

Hey @mzealey if you feel up to it, feel free to test with this branch. I think all cases SHOULD be resolved. Thank you so much for the error reports and following this up

@mzealey
Copy link

mzealey commented Aug 21, 2019

Yes this fixes my live use-case thank you!

@JoviDeCroock JoviDeCroock changed the base branch from scu-fix-2 to master August 25, 2019 11:15
@JoviDeCroock JoviDeCroock requested a review from developit August 25, 2019 11:15
Copy link
Member

@andrewiggins andrewiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thanks for the good test cases 👍

src/component.js Outdated Show resolved Hide resolved
src/diff/index.js Outdated Show resolved Hide resolved
test/browser/lifecycles/shouldComponentUpdate.test.js Outdated Show resolved Hide resolved
@sventschui
Copy link
Member

sventschui commented Sep 4, 2019

When a component bails out using sCU===false it's children are not diffed. This lead to outdated _parent pointers on the children what ultimately lead to updateParentDomPointers update the _dom pointer of a wrong/old parent vnode. Thanks to @JoviDeCroock for the support in finding this.

My fix in #229c135 fixes this. It adds some bytes to the bundle (Update: Travis says it adds 32 bytes). Since I couldn't get my local build to run (terser issue) I could not yet do advanced bytes golfing, so feel free to try your luck reducing the footprint of this fix 🍀

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So good! Love that you two worked together to get to the bottom of it 👍 💯

@sventschui
Copy link
Member

for (tmp = 0; tmp < newVNode._children.length; tmp++) {
	if (newVNode._children[tmp]) newVNode._children[tmp]._parent = newVNode;
}

vs.

newVNode._children.some(child => {
	if (child) child._parent = newVNode;
});

where the later saves 11B but is slower during runtime. What to prefer?

@developit
Copy link
Member

@sventschui my suggestion would be that we use the for loop for now, but we should do a PR to convert not only this but other loops to other syntax at the same time - that will let us measure the effect without it being confounded by mixed syntax.

Also I wondered if this was smaller?

const c = newVNode._children;
for (tmp = c.length; tmp--; ) {
    if (c[tmp]) c[tmp]._parent = newVNode;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants