Allow access to parent before onBeforeMount() call #2910
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Answer the following depending on the type of change you want to merge
Code
Have you added test(s) for your patch? If not, why not?
Nothing to test
Can you provide an example of your patch in use?
Demo (bug with 5.4.1):
https://codesandbox.io/s/riotjs-5-provide-inject-bug-oub7z?file=/index.html
Demo (no bug, patched 5.4.1)
https://codesandbox.io/s/riotjs-5-provide-inject-k9m6u?file=/index.html
Is this a breaking change?
No
Content
Provide a short description about what you have changed:
Hello. I tried to make behavior similar to vue setup and provide / inject (https://v3.vuejs.org/guide/composition-api-provide-inject.html#scenario-background). I need
setup
to be executed before anyonBeforeMount
until the component is rendered. In this case, I can in thesetup
inject the data provided in the parent component and for this I need to have access to the parent before the component is rendered. I noticed that the link to the parent is at the very beginning of the mount method of the components and I did not find any reason why it cannot be raised higher. In this case, what I want to do is working as expected.