Skip to content

Enhanced paths

Compare
Choose a tag to compare
@presidenten presidenten released this 10 Jun 14:18
· 34 commits to master since this release

A few breaking changes in this version, but the new features are super sweet and well worth it.

Updates:

  • All module states are extended with $parent which allows submodules to read their parents state and thus the parents other submodules.
  • The library is now optimized to use strings for paths instead of the api. The api is deprecated and will be removed in the next major version.
  • Global is removed (breaking change) and root is introduced.
  • root accepts keywords together with context.state to make path navigation simpler. Easy access to parents getters and the root module in the same instance tree.
    • root.get({ path: '$parent/getter', state: context.state }) expands to full path with parent instances
    • root.get({ path: '$root/getter', state: context.state }) expands to root module instance path
  • addStore is removed (breaking change) and register is introduced.
  • register takes a store name and returns a mixin that can be used instantly in the mixin property.
  • To get the Vue and Vuex plugins are now accessed through functions from Vuex+ (breaking change). It was necessary to be able to patch Vuex to add $parent when inserting new states through Vue devtools.
  • Works nicely mixed with normal vuex modules. By following file naming conventions they also get automatic HMR.
  • Bug fix where files with -store in middle of the filename would get weird module names.