How do I pass the pinia instance to mapState? #1016
Unanswered
andrei-gheorghiu
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context: I've switched a large project from vuex to pinia. the project is still on vue 2 but I'm migrating the syntax to composition api, using
@vue/composition-api
and the project will be migrated to vue3 at some point.The problem: The tests are passing, but after each of them I'm seeing errors thrown, along these lines:
There are plenty of these errors (6-8, each time) but, again, the tests are passing. I'm only seeing these after the tests finish. The funny thing is the amount of errors is not really dependent on how many tests are run. If I run only 1 test. I see pretty much the same number of errors as when I run all tests. And always after tests end.
My wild guess here is this has to do with the fact I'm using
mapState
and I was wondering if there's a way to pass the store instance tomapState
.To make things worse, creating a minimal reproducible example is not exactly a simple task, as I'm running the tests through a testing engine, which adds all plugins to a localVue, loads and inits all stores, as they're inter-dependent.
One option is to start rewriting the tests without this engine and only create what each component needs, but it's a lot of work and the testing engine worked well so far and greatly reduces the boilerplate in each test.
My question:
Beta Was this translation helpful? Give feedback.
All reactions