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

Silence inject dev warning: injection not found #892

Closed
vmihailenco opened this issue Mar 27, 2020 · 1 comment · Fixed by #894
Closed

Silence inject dev warning: injection not found #892

vmihailenco opened this issue Mar 27, 2020 · 1 comment · Fixed by #894

Comments

@vmihailenco
Copy link

vmihailenco commented Mar 27, 2020

What problem does this feature solve?

I am using provide/inject as component store and want to provide some value if it is not already provided by parent component, e.g.:

let v = inject(key)
if (!v) {
    provide(key, value)
}

It works well except that on first invocation there is a warning that injection not found.

What does the proposed API look like?

Remove the warning or provide some way to silence it or "declare" injection value without overriding existing one, e.g.:

inject(key, undefined) // undefined means set value if it does not already exist
@saddam1234567
Copy link

"export 'inject' was not found in 'vue'

@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants