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(compat): ensure functional component is not null in $children #10982

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andreww2012
Copy link

In compat mode, if a component is functional, it will be null in $children array. This happens because $children are formed from proxy property which is not set for functional components:

const isStateful = isStatefulComponent(instance)
initProps(instance, props, isStateful, isSSR)
initSlots(instance, children)
const setupResult = isStateful
? setupStatefulComponent(instance, isSSR)
: undefined

Inside setupStatefulComponent:

instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers)

The fix is to use component.ctx (which is the proxy's original object) as a fallback when populating $children. I do realize this is not the same object as the wrapped one but this might be sufficient for migration purposes.

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.7 kB 34.5 kB 31.1 kB
vue.global.prod.js 148 kB 53.7 kB 48.1 kB

Usages

Name Size Gzip Brotli
createApp 50.8 kB 19.9 kB 18.1 kB
createSSRApp 54.1 kB 21.2 kB 19.3 kB
defineCustomElement 53.1 kB 20.6 kB 18.8 kB
overall 64.5 kB 24.9 kB 22.6 kB

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

Successfully merging this pull request may close these issues.

None yet

2 participants