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

Allow access to parent before onBeforeMount() call #2910

Merged
merged 2 commits into from
May 15, 2021

Conversation

kachurun
Copy link
Contributor

@kachurun kachurun commented May 11, 2021

Answer the following depending on the type of change you want to merge

Code

  1. Have you added test(s) for your patch? If not, why not?
    Nothing to test

  2. 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

  3. 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 any onBeforeMount until the component is rendered. In this case, I can in the setup 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.

@GianlucaGuarini
Copy link
Member

I think that's a good Idea. Could you please add a small test for this patch? I think that's the right place for it https://github.com/riot/riot/blob/main/test/specs/lifecycle-events.spec.js

@kachurun
Copy link
Contributor Author

@GianlucaGuarini Done

@GianlucaGuarini GianlucaGuarini merged commit be5851a into riot:dev May 15, 2021
@GianlucaGuarini
Copy link
Member

thank you

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

Successfully merging this pull request may close these issues.

None yet

2 participants