Closed rob-64 closed 3 years ago
@karol-f any chance of reviewing this?
Can You please describe what You want to achieve? What problem does this solution solve?
Can You please describe what You want to achieve? What problem does this solution solve?
I have a very unique use case where I need to fetch some instanced props and initial vuexState during Vue init... so by returning a promise, I can use an ajax call to get what I need from the server
Ok, so why not making a beforeCreateVueInstance
a Promise
? Will it work? Seems a little bit cleaner.
Ok, so why not making a
beforeCreateVueInstance
aPromise
? Will it work?
Thats what I did... it can now return the Options or a Promise
@karol-f or maybe I misunderstand what you're saying
Hi, checking Your PR, I can see that You are modifying createVueInstance
and not beforeCreateVueInstance
- that's why I'm asking.
I didn't analyse if solution You've introduced is better one. I'm still not sure if it's necessary. At least in that form.
Hi, checking Your PR, I can see that You are modifying
createVueInstance
and notbeforeCreateVueInstance
- that's why I'm asking.I didn't analyse if solution You've introduced is better one. I'm still not sure if it's necessary. At least in that form.
![]()
Gotcha, so I made it so that the function beforeCreateVueInstance can return either the options or a promise of the options.
So then inside the util function of createVueInstance I chain off of the promise and return true once the options are returned and then the vue instance is created. That way I only invoke the vueInstanceCreatedCallback once its truly done.
@karol-f does that make sense what my plan was? I still don't understand what you are suggesting.
Hi, I am currently a little busy, I will try to get back to it as soon as possible.
Hi, I am currently a little busy, I will try to get back to it as soon as possible.
Hi @karol-f, any chance we could continue this PR?
@karol-f Can we review this PR again?
I updated createVueInstance to return a Promise so I can chain it with the Promise now returned by beforeCreateVueInstance....
Hi, thank You for the PR. Sorry for the long wait. It looks good!
I've copied Your changes (not merging the branch) as some changes (like dist or docs updating) I do during release. I hope it's ok with You.
Allows developer to perform any async calls to init the root vue opts