Subscribe on changes!

Provide and inject dynamically introduces responsive attributes, assign to ref as default

avatar
Apr 25th 2022

Version

3.2.33

Reproduction link

https://github.com/vuejs/core

Steps to reproduce

parent.vue import { equKey } from '../type' const equListRef = ref([] as typeof equKey[]) provide(equKey, equListRef)

son.vue import { equKey } from '../../../type' const euqlist = inject(equKey) const equSelect = ref(euqlist?.value[0].id)

What is expected?

At first, I wanted (euqlist?. value [0]. ID) as the default value. Later, I analyzed that its value was non responsive and null But why do warnings appear so that the page cannot be displayed?

What is actually happening?

  • [Vue warn]: Unhandled error during execution of setup function at at at at <MianIndex onVnodeUnmounted=fn ref=Ref< undefined > > at at
  • warn @ runtime-core.esm-bundler.js:38 runtime-core.esm-bundler.js:38 [Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core at at at at <MianIndex onVnodeUnmounted=fn ref=Ref< undefined > > at at
  • warn @ runtime-core.esm-bundler.js:38 runtime-core.esm-bundler.js:38 [Vue warn]: Unhandled error during execution of mounted hook at at <MianIndex onVnodeUnmounted=fn ref=Ref< undefined > > at at
  • warn @ runtime-core.esm-bundler.js:38 runtime-core.esm-bundler.js:38 [Vue warn]: Unhandled error during execution of mounted hook
avatar
Apr 25th 2022

Please follow the issue requirements and provide a runnable reproduction.