question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuxt.js and vuex: "TypeError: Cannot read property 'state' of undefined"

See original GitHub issue

Bug 🐞

What is the current behavior?

When including:

serverPrefetch() {
    return this.instantsearch.findResultsState(this).then(algoliaState => {
      this.$ssrContext.nuxt.algoliaState = algoliaState;
    });
  }

with Vuex action:

nuxtServerInit({ commit }) {
    commit("SET_TEST", true);
 }

console prints Vue warning Error in render: [Vue warn]: Error in render: "TypeError: Cannot read property 'state' of undefined"

I’m not sure if this is fixed two days ago with #864, but this version is not available through npm or yarn registry. NPM registry shows the last update to made month ago.

Make a sandbox with the current behavior

https://codesandbox.io/s/vue-instantsearch-vuex-error-1n6qp

What is the expected behavior?

Should not have an error and vuex state should be working correctly.

What is the version you are using?

Nuxt.js v2.12.2 vue-instantsearch v3.2.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Haroenvcommented, Sep 27, 2020

Hey! We’ve merged a fix for this last week, but not yet released. Will do first thing Monday!

0reactions
Haroenvcommented, Sep 28, 2020

Fixed now @eljass 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue.js - Vuex Cannot read property 'state' of undefined
the use method accept one plugin as first parameter and options (which si optional) as second one app.use(plugin, itsOptions) , so you ...
Read more >
Uncaught TypeError: Cannot read property 'state' of ...
Without understanding why this happens, I decided to report the problem. If I remove the import store from file 'src/app/auth/services/auth.js', ...
Read more >
TypeError: Cannot read property of undefined (Vuex Store)
The error message states that it can't read the property description of undefined , so from that we deduce that state.collection.info is ...
Read more >
vuex cannot read properties of undefined (reading 'state')
I have a spec file that mounts a very simple component that checks a value in the vuex store and creates a link....
Read more >
Vuex Store (state undefined)
I have problem while setting up VueX Store My Store: import Vuex from 'vuex'; ... Error in render: "TypeError: Cannot read property 'state'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found