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

docs: Clarify inject data when multiple parent provide the same key #3175

Conversation

kfina-planxy
Copy link
Contributor

Description of Problem

It was unclear in the docs, how the situation is handled if multiple parents provide the same key.

Explain how multiple parent provides are handled.
Copy link

netlify bot commented Feb 11, 2025

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit cf6c364
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/67ab622665e7b80008d3dabb
😎 Deploy Preview https://deploy-preview-3175--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@NataliaTepluhina NataliaTepluhina merged commit 7cabdc9 into vuejs:main Feb 18, 2025
5 checks passed
@AloisSeckar
Copy link
Contributor

AloisSeckar commented Feb 19, 2025

I am just translating this into cs.vuejs.org and this sentence doesn't clarified it much for me. Is it the "first" going up from the root component or closest to the injecting child?

My second objection: This only added the sentence into Options API block and not the Composition API one...

I will think about an improvment and post the PR soon

@kfina-planxy
Copy link
Contributor Author

Closest to the child:
Starting from the child that injects you go to its parent and check if its parent provides that key. If so, use that key, otherwise go to the its parent and check again.

Example:

    [ A ] provides: x=1
   /     \
[ C ]   [ B ] provides: x=2
x=1        \
           [ C ]
            x=2

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

Successfully merging this pull request may close these issues.

3 participants