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

refactor(tiny-react): handle children re-insertion in fragment reconcilation #169

Open
wants to merge 15 commits into
base: refactor-tiny-react-reverse-insert-order
Choose a base branch
from

Conversation

hi-ogawa
Copy link
Owner

@hi-ogawa hi-ogawa commented Oct 19, 2023

Currently, each VNode itself is responsible for (re-)inserting itself even when "mutating" case by placeChild

if (
bnode.type === NODE_TYPE_TAG &&
bnode.vnode.key === vnode.key &&
bnode.vnode.ref === vnode.ref &&
bnode.vnode.name === vnode.name
) {
if (isHydrate) {
hydrateTagProps(bnode, vnode.props);
} else {
reconcileTagProps(bnode, vnode.props, bnode.vnode.props);
}
bnode.vnode = vnode;
bnode.child = reconcileNode(
vnode.child,
bnode.child,
bnode.hnode,
null,
effectManager,
isHydrate
);
placeChild(hparent, bnode.hnode, hnextSibling, false);
} else {

But, this is probably rather uncommon and had some issue with implementing memo based optimization (cf. #168).

@hi-ogawa hi-ogawa changed the title refactor(tiny-react): simplify placeChild refactor(tiny-react): let parent vnode responsible for child re-insertion on mutation Oct 19, 2023
@hi-ogawa hi-ogawa mentioned this pull request Oct 19, 2023
16 tasks
@hi-ogawa hi-ogawa marked this pull request as ready for review October 19, 2023 04:30
@hi-ogawa hi-ogawa changed the title refactor(tiny-react): let parent vnode responsible for child re-insertion on mutation refactor(tiny-react): let parent responsible for child re-insertion on mutation Oct 19, 2023
@hi-ogawa hi-ogawa changed the base branch from main to refactor-tiny-react-reverse-insert-order October 19, 2023 14:08
@hi-ogawa hi-ogawa changed the title refactor(tiny-react): let parent responsible for child re-insertion on mutation refactor(tiny-react): let fragment responsible for child re-insertion on mutation Oct 21, 2023
@hi-ogawa hi-ogawa mentioned this pull request Oct 21, 2023
4 tasks
@hi-ogawa hi-ogawa changed the title refactor(tiny-react): let fragment responsible for child re-insertion on mutation refactor(tiny-react): handle child re-insertion in fragment reconcilation Oct 21, 2023
@hi-ogawa hi-ogawa changed the title refactor(tiny-react): handle child re-insertion in fragment reconcilation refactor(tiny-react): handle children re-insertion in fragment reconcilation Oct 21, 2023
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.

1 participant