Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Store is not available to functional components #1549
Comments
Unfortunately I have no solution for you... What environment are you writing your tests in? |
Node: v10.19.0 |
maybe related #1507
|
Well, @joaovitoras, have you tried not using the localVue and using the global instead, I think in your example there is no need for it, right? |
You can try ^ however I would expect the same problem to manifest. Unrelated, but is common to use a non-functional component inside a functional component? This seems very strange to me - functional (aka stateless) components are normally UI only, and the very "bottom" of the render tree. It seems strange that they would then contain more complexity via a stateful component. I could be completely wrong here, since I don't have context - in my apps I never render a stateful component inside a functional component. This is still definitely a bug in VTU that should be fixed. Based on my explorations a few days ago, I have no idea why this happens or how to fix it at this point in time. |
Tks @lmiller1990. I decided by changing how the feature was made instead of trying to use vuex with the functional |
Version
1.0.0-beta.29
Reproduction link
https://jsfiddle.net/joaovitoras/37sc6Len/
Steps to reproduce
Creates a FunctionalComponent that renders the Balloon component
The Balloon component uses the vuex state in template
When I mount with VueTestUtils the Main component that contains the Functional Component, store is unavailable and breaks the code
When I mount with Vue the Main component works fine https://jsfiddle.net/joaovitoras/hnawzo43/
What is expected?
I hope that somehow the store will be available in the component rendered by the functional component
What is actually happening?
store is not available