Subscribe on changes!

Provide & inject not working when injection has default value

avatar
Sep 8th 2020

Version

3.0.0-rc.10

Reproduction link

https://codesandbox.io/s/vue-provide-inject-mg2oy?file=/src/index.js

Steps to reproduce

https://codesandbox.io/s/vue-provide-inject-mg2oy?file=/src/index.js

What is expected?

It should render without error

Accroding to https://v3.vuejs.org/api/options-composition.html#provide-inject

I think it should work

image

What is actually happening?

injection is null

avatar
Sep 8th 2020

It looks like a problem with from being missing:

https://github.com/vuejs/vue-next/blob/b53d45de65239fa4acd9c6bc41ed58fc9b823729/packages/runtime-core/src/componentOptions.ts#L461

I suspect that should be defaulting to key if from isn't set.