Closed
Description
Version
3.0.0-rc.10
Reproduction link
https://codesandbox.io/s/admiring-snow-4u748?file=/src/Child.vue
Steps to reproduce
Open the reproduction link, in parent component setup we have:
setup() {
const msg = ref("initial");
provide("CONTEXT", { msg });
return {
msg
};
}
and in a child component setup:
setup() {
const ctx = inject("CONTEXT");
// not working (works when wrapped inside onBeforeMount)
ctx.msg.value = "updated";
}
What is expected?
the screen should show: "updated"
What is actually happening?
the screen shows "initial"
It works fine when wrapped inside a lifecycle hook:
onBeforeMount(() => {
ctx.msg.value = "updated";
})
I'm not sure if it's a bug or intentional behavior, but I find it weird since the parent's setup function is executed before the child's.
Metadata
Metadata
Assignees
Labels
No labels