vuex icon indicating copy to clipboard operation
vuex copied to clipboard

Vuex Store undefined SSR with component as both child and root

Open 0Rick0 opened this issue 3 years ago • 0 comments

Version

3.6.2

Reproduction link

github.com

Steps to reproduce

  • Create two components (CompA and CompB)
  • CompB uses CompA as a child
  • Create a simple store
  • Extend CompB with the store
  • Create Vue instance of CompB (instanceB)
  • Render instanceB with SSR (renderToString)
  • Extend CompA with store
  • Create Vue instance of CompA (instanceA)
  • Render instanceA with SSR
  • Try to extract the store's state of instanceA

What is expected?

instanceA's and instanceB's $store should be defined

What is actually happening?

instanceA's store is undefined instanceB's store was defined


It appears that after a component has been used as a child component, it can no longer be used as a root component. As of yet I haven't managed to reproduce the bug in a normal client app. See the minimal reproduction repo for an example.

Not sure if this bug should be logged with Vuex or with Vue.

0Rick0 avatar Feb 01 '22 12:02 0Rick0