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(runtime-core): should not track dynamic children when the user calls a compiled slot inside template expression #3554

Merged
merged 5 commits into from
May 25, 2021

Conversation

HcySunYang
Copy link
Member

@HcySunYang HcySunYang commented Apr 7, 2021

Fix: #3548

Edit:

Also fix #3569, at first I tried to fix issue #3569 in another independent PR(#3573), and then I realized the strong coupling between issue #3548 and issue #3569, so I merged them into this one PR.

Issue #3569 is another problem caused by the mixed-use of optimization mode and manual render function, technically, the user can get any VNode in the manually written render function, e.g.

setup(props, { slots }) {
  const index = ref(100)
  return () => {
    // get any vnode
    return slots.foo()[3].children[index.value]
  }
}

Suppose the initial value of index is 100, and then it becomes 999, then the old and new subTree may be:

// old
{ type: 'div', dynamicChildren: [vnode1, vnode2] }
// new
{ type: 'div', dynamicChildren: [vnode99], patchFlags: xxx }

Obviously, they are not comparable, and they may come from different levels.

The idea is, for slots, if the user manually obtains the contents of the slot by calling the slots function, we should be forced to bail out the optimization mode

@HcySunYang HcySunYang added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Apr 7, 2021
@HcySunYang HcySunYang added ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. and removed 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels May 8, 2021
@yyx990803 yyx990803 merged commit 2010607 into vuejs:master May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf.
Projects
None yet
2 participants