The Wayback Machine - https://web.archive.org/web/20220826073116/https://github.com/vuejs/vue/issues/12678
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

Provide/Inject does not work within same component #12678

Closed
johannes-z opened this issue Jul 18, 2022 · 2 comments
Closed

Provide/Inject does not work within same component #12678

johannes-z opened this issue Jul 18, 2022 · 2 comments

Comments

@johannes-z
Copy link

johannes-z commented Jul 18, 2022

Version

2.7.7

Reproduction link

https://github.com/johannes-z/vue27/tree/bug/provide-inject

Steps to reproduce

  1. git clone https://github.com/johannes-z/vue27/
  2. git checkout bug/provide-inject
  3. pnpm i
  4. pnpm run dev

What is expected?

provide in setup and inject in render should work.

What is actually happening?

An error is thrown:

[Vue warn]: injection "Symbol(test)" not found.


With @vue/composition-api it's possible to provide a value in the setup and use inject in the render function, whereas vue only seems to check parents for provided values.

@jacekkarczmarczyk
Copy link

jacekkarczmarczyk commented Jul 18, 2022

It seems to be now consistent with Vue 3 behaviour

@yyx990803
Copy link
Member

yyx990803 commented Jul 20, 2022

This is expected behavior - 2.7 aligns everything with 3.x. Any deviance between @vue/composition-api plugin and v3 should be considered a bug in the plugin and use v3 as the source of truth.

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

No branches or pull requests

3 participants