nativescript-vue-devtools icon indicating copy to clipboard operation
nativescript-vue-devtools copied to clipboard

Vuex

Open mrmonat opened this issue 6 years ago • 33 comments

Is vuex supposed to be shown when used? For me it just says "No Vuex Store detected".

mrmonat avatar Sep 22 '18 12:09 mrmonat

IIRC, the webinar they had yesterday (Oct. 4th) stated that this is a "coming soon" feature.

subhaze avatar Oct 05 '18 16:10 subhaze

Any update on this feature?

vlowe85 avatar Jan 21 '19 09:01 vlowe85

Subscribing to this

megabayt avatar Feb 12 '19 09:02 megabayt

https://github.com/vuejs/vuex/pull/1404 has been merged, but Vuex has not been released since then. Once a new version gets released, it will work out of the box.

rigor789 avatar Mar 30 '19 18:03 rigor789

Tried running vuex from the dev branch, but no dice. Anyone got this to work?

madsb avatar Apr 14 '19 18:04 madsb

@madsb No luck on my end either, this item should be prioritized higher considering VueX is a major feature utilized by nearly all VueJS applications. What are your thoughts?

keithgulbro avatar Apr 22 '19 02:04 keithgulbro

Cannot get this working either no matter what I have tried. This is critical as far as I am concerned as well for a good working development environment. Hopefully, soon!

ExcelNet-Public avatar Apr 25 '19 13:04 ExcelNet-Public

Agreed, would be great to have this implemented!

danieltran avatar May 01 '19 01:05 danieltran

https://github.com/vuejs/vuex/releases/tag/v3.1.1 released yesterday

odai-alali avatar May 10 '19 08:05 odai-alali

It's alive 👹 image

odai-alali avatar May 10 '19 09:05 odai-alali

Can't seem to get this to work no matter what I do. I still get "No Vuex store detected." in vue-devtools. @odai-alali, did you just upgrade to 3.1.1 and it ran out of the box?

madsb avatar May 12 '19 09:05 madsb

@madsb what order are you importing Vuex/VueDevtools? I found out it sometimes matters! (VueDevtools should be before Vuex)

rigor789 avatar May 12 '19 11:05 rigor789

@madsb Yeah, I've just updated the package version and it worked after that.

This is my main.js

import Vue from 'nativescript-vue';

import VueDevtools from 'nativescript-vue-devtools'

import store from './store';
import BackendService from './services/BackendService'
import Login from './screens/Login'
import Home from './screens/Home'
const backendService = new BackendService()
Vue.config.silent = (TNS_ENV === 'production');
//use devtools
if(TNS_ENV !== 'production') {
  Vue.use(VueDevtools, { host: '192.168.208.125' });
}
new Vue({
  components: {
    Home,
    Login
  },
  computed: {
    isSoftLoggedIn () {
      return backendService.isSoftLoggedId()
    }
  },
  template: `
    <Frame>
      <Login v-if="!isSoftLoggedIn" />
      <Home v-if="isSoftLoggedIn" />
    </Frame>
  `,
  store,
}).$start({
  getRootView(vm) {
    return vm.$el.nativeView
  }
});

odai-alali avatar May 13 '19 08:05 odai-alali

I've just noticed that the state is not changing in devtools. The store is detected though.

odai-alali avatar May 13 '19 10:05 odai-alali

@odai-alali Did you ever find a solution? I'm running into the same issue

cjharkins avatar May 16 '19 19:05 cjharkins

@cjharkins unfortunately not. I switched to another project.

odai-alali avatar May 17 '19 08:05 odai-alali

I too am unable to get Vuex to load in vue-devtools. I've enabled/disabled the Vuex options under vue-devtools with no luck.

image

package.json

"@vue/devtools": "^5.1.0",
"nativescript-socketio": "^3.2.1",
"nativescript-toasty": "^1.3.1",
"nativescript-vue": "^2.0.0",
"nativescript-vue-devtools": "^1.2.0",
"tns-core-modules": "^5.0.2",

main.js

import Vue from 'nativescript-vue'
import store from './store';
import router from './router';

import VueDevtools from 'nativescript-vue-devtools'

if(TNS_ENV !== 'production') {
    Vue.use(VueDevtools, {
        host: '192.168.1.85'
    })
    Vue.config.devtools = true;
}

Vue.config.silent = (TNS_ENV === 'production')

new Vue({
    store,
    render: h => h('frame', [h(router['home'])])
}).$start()

store/index.js

import Vue from 'nativescript-vue';
import Vuex from 'vuex'
import { default as modules } from './modules'

Vue.config.devtools = true;

Vue.use(Vuex)

export default new Vuex.Store({
    modules: modules
})

rebz avatar May 22 '19 00:05 rebz

@rebz Look at what @rigor789 said. I fixed it by making import VueDevtools from 'nativescript-vue-devtools' be above import store from './store';.

However it still isn't perfect to me, NativeScript crashes when mutating the state (inside a mutation).

Wiejeben avatar May 22 '19 06:05 Wiejeben

Seems like there has been some refactoring around Vuex in the devtools recently...

It was working perfectly fine when I created the PR to vuex to allow usage in nsvue.

I don't currently have time to look through the source of vuex/vue-devtools to debug why it doesn't work every time. (For me, even with the correct import order, occasionally it would not show up)

rigor789 avatar May 22 '19 08:05 rigor789

@Wiejeben - Had been doing that, it has still yet to work. In the mean time I created several computed properties in my root component that returned the state of each store module. Ugly fix, but it works for now.

rebz avatar May 25 '19 12:05 rebz

Works for me when I update the vuex package to 3.1.1 and put the code like this way:

if(TNS_ENV !== 'production') {
  Vue.use(VueDevtools, { host: '<your ip addr>' })
}

import store from './store/index';

zzhenryquezz avatar May 29 '19 15:05 zzhenryquezz

In my end, the issue is this

CesarGomezTissini avatar Aug 27 '19 17:08 CesarGomezTissini

I've just noticed that the state is not changing in devtools. The store is detected though.

I have exactly the same problem. I can see the store state at start up but it does not get updated when the state changes. This makes the vue tools pretty much useless. Has anyone found a solution to this?

belvederef avatar Nov 24 '19 17:11 belvederef

Once I've moved the import store line below the VueDevtools, I get a

file:///app/webpack:/home/akryum/Projects/vue-devtools/node_modules/@vue-devtools/app-backend/src/hook.js:419:0: JS ERROR ReferenceError: Can't find variable: HTMLElement

Funny thing is that a suggestion for this problem is to put the store import above : https://stackoverflow.com/a/58753786/664179

So it becomes kind of a chicken and egg problem, not sure what else try to get the Vuex state to show up in the dev tools using tns version 6.1.1 (ios) and 6.1.2 (android)

UPDATE: With these 2 changes I can see the store in the debug tools!

main.ts

import VueDevtools from 'nativescript-vue-devtools'
Vue.use(VueDevtools)
import store from "./store/index";  // moved after the VueDevTools definitions

And a fix for the ReferenceError: Can't find variable: HTMLElement here: https://stackoverflow.com/a/58983252/664179

svilenkov avatar Dec 23 '19 13:12 svilenkov

I tried everything in this issue and I still have "No Vuex store detected" with latest version (1.4.0).

Anyone has made it work?

sebj54 avatar Apr 22 '20 10:04 sebj54

@sebj54 I was testing this a few days ago, using latest @vue/devtools and latest nativescript-vue-devtools

I also swapped the import order to be

// ...
import VueDevtools from 'nativescript-vue-devtools'
// ...
Vue.use(VueDevtools)
// ...
import store from './store'

and the store would show up in devtools - and I could change state, see mutation logs etc.

rigor789 avatar Apr 22 '20 11:04 rigor789

I may have an issue somewhere because this is something I tried and it did not work. Maybe namespaced Vuex modules?

Do you do extra steps after chaning your main.js file? Cleaning platforms folder maybe?

Does vue-cli-template work out of the box with Vuex? I think I should start with an empty app to reduce possible context errors.

sebj54 avatar Apr 22 '20 12:04 sebj54

@sebj54 yes, a new vue-cli-template project should be working fine. That's what I was testing with (and updated the template to make it work properly)

rigor789 avatar Apr 22 '20 15:04 rigor789

I had this problem and updated the dependencies, the older template had [email protected]. It now works for me while creating a new project from template.

DocPaintfull avatar May 02 '20 14:05 DocPaintfull

Hi @rigor789, I just started a fresh new project with the latest vue-cli-template and it worked as expected! My store is still empty but I can see it in Vue Devtools.

I'll let you know if it stops working when I'll add store modules.

sebj54 avatar May 11 '20 15:05 sebj54