Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

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

Closed
eljass opened this issue Sep 26, 2020 · 5 comments
Closed

Comments

@eljass
Copy link

eljass commented Sep 26, 2020

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

@Haroenv
Copy link
Contributor

Haroenv commented Sep 27, 2020

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

@Haroenv
Copy link
Contributor

Haroenv commented Sep 28, 2020

The fix (#864) has been released in version 3.3.0 now!

@Haroenv Haroenv closed this as completed Sep 28, 2020
@eljass
Copy link
Author

eljass commented Sep 28, 2020

@Haroenv do you know when this will be available in NPM registry?

@Haroenv
Copy link
Contributor

Haroenv commented Sep 28, 2020

Hmm, this should have been available this morning, let me check what's going on!

@Haroenv
Copy link
Contributor

Haroenv commented Sep 28, 2020

Fixed now @eljass 👍

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

No branches or pull requests

2 participants