-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
VueX store is unavailable on new pages #5
Comments
Hi, Same problem for me, did you find a solution ? |
Absolutely not; I continue to use a messy workaround to handle routes. |
Do you use this._vm.$navigateTo() in actions ? If I use this, the store will be undefined in next page |
I used |
It seems like what is actually happening is that child components of the navigated to component are not getting the store, but the parent is. Another work around is to bubble events up to the parent and have that access the store. Obviously not ideal, but possibly this info helps solve the bug... |
You can work around this issue with a local copy of the plugin as you'll have to edit it directly. You'll have to replace nativescript-vue-navigator/index.js Line 52 in 1109e11
And replace nativescript-vue-navigator/index.js Line 55 in 1109e11
That being said....I have no idea of this is a good workaround or not. I've put a question out to @rigor789 to see if this is something that should be done or not. FYI, came across this method as a possibility here: nativescript-vue/nativescript-vue#365 |
fyi, here's a repo that reproduces the issue: https://github.com/jawa-the-hutt/ns-vue-navigator-test it does NOT include the workaround in my previous comment. |
I have the same problem, it happens to the main component that was navigated to. I have an app with 2 screens, one uses the store, if I navigate away and come back, the store is no longer available. I worked around it by importing the store into each component that requires it instead of injecting it into the Vue instance. |
Generally the issues is most likely due to the "weird" parent/child relations between navigated components (I have plans to improve this, but it wasn't straight-forward when I last worked on it). Does setting |
Setting the prototype seems to have fixed it for me |
works like a charm |
Hi !
I use VueX to manage the app's state. It works fine on the
defaultPage
but I can't navigate to views that uses it:The whole
$store
object is not available to new views; I guess it also may be the same for other objects/pluginsThe text was updated successfully, but these errors were encountered: