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

Cannot read property 'count' of undefined on refinement components #874

Closed
singhofmarco opened this issue Oct 1, 2020 · 1 comment · Fixed by #876
Closed

Cannot read property 'count' of undefined on refinement components #874

singhofmarco opened this issue Oct 1, 2020 · 1 comment · Fixed by #876

Comments

@singhofmarco
Copy link

Bug 🐞

What is the current behavior?

Console error is shown "Cannot read property 'count' of undefined" for every refinement component since last version. Component works as expected though.

Error in callback for watcher "state": "TypeError: Cannot read property 'count' of undefined"

Make a sandbox with the current behavior

https://codesandbox.io/s/nice-ives-16unm?file=/src/App.vue

What is the expected behavior?

No error should show up in the console.

Does this happen only in specific situations?

No.

What is the proposed solution?

What is the version you are using?

v3.4.1

@Haroenv
Copy link
Contributor

Haroenv commented Oct 1, 2020

not sure yet what the solution is, but I can see it came from #871

Haroenv added a commit that referenced this issue Oct 5, 2020
Most of the widgets were assuming the shape of state is always "right", but since #871 it is also called with an empty object. This PR does the following things:

- changes all widgets to work correctly with empty object
- makes sure always a boolean is returned from mapStateToCanRefine to make tests easier
- make tests of mapStateToCanRefine consistent, as well as adding a unit test to each of the methods using {} as state

closes #875
fixes #874
Haroenv added a commit to algolia/instantsearch that referenced this issue Dec 28, 2022
…nstantsearch#876)

Most of the widgets were assuming the shape of state is always "right", but since algolia/vue-instantsearch#871 it is also called with an empty object. This PR does the following things:

- changes all widgets to work correctly with empty object
- makes sure always a boolean is returned from mapStateToCanRefine to make tests easier
- make tests of mapStateToCanRefine consistent, as well as adding a unit test to each of the methods using {} as state

closes algolia/vue-instantsearch#875
fixes algolia/vue-instantsearch#874
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants