question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Proposal] Allow existing store modules to provide additional properties like the customActions, etc.

See original GitHub issue

Current state

Currently, if the namespace for a service resolves to the namespace of an existing store module that is not a service module, the existing module is overwritten without consideration of its setup. This behavior may be confusing for some users and probably hurts adoption, as it makes it difficult to go from a working store with its own custom service interactions to a working store that uses feathers-vuex, since they are silently incompatible.

Proposal

I’d like to propose adding a flag to the vuexOptions object (perhaps respectExisting) that would instruct new service-modules to take on the state/getters/actions/mutations of any modules with the same resolved namespace that exist in the store.

I’ve made a POC: https://github.com/jskrzypek/feathers-vuex/compare/feat-array-namespaces...feat-respect-existing (this is based on my PR #35)

Alternatives

The other possible fix I can think of would be to automatically nest the service module on the existing module, though this can result in unpredictable namespaces.

What do you think?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marshallswaincommented, Aug 24, 2017

I’ve released the 1.0.0 beta, which include the ability to customize the store and fixes the “clobbering” of state, etc. Please check out the details here: https://github.com/feathersjs/feathers-vuex/issues/40. I’m closing this issue. Feel free to reopen after trying the new version, if needed.

1reaction
jskrzypekcommented, Aug 8, 2017

@ellipticaldoor I found a way around that specific problem, you currently can give specific namespaces to feathers-vuex before it clobbers your existing modules, you just need to do it in the initial call to feathers-vuex.

you can do it like this:

const feathersClient = feathers()
  .configure(hooks())
  .configure(socketio(socket))
  .configure(auth({ storage: window.localStorage }))
  .configure(rx(RxJS, {idField: '_id'}))
  .configure(feathersVuex(store, {
    idField: '_id',
    auth: {
      userService: '/users'
    }
  }, {
    'messages': { namespace: 'feathersMessagesServiceModule' },
    'users': { namespace:  'feathersUsersServiceModule' }
  }))

or to illustrate the arguments to feathersVuex better:

const feathersVuexOptions = {
  idField: '_id',
  auth: {
    userService: '/users'
  }
}

const feathersVuexModules = {
  'messages': 'feathersMessagesServiceModule', // or { namespace: 'feathersMessagesServiceModule'  },
  'users': 'feathersUsersServiceModule' // or { namespace:  'feathersUsersServiceModule' }
}

const feathersClient = feathers()
  .configure(hooks())
  .configure(socketio(socket))
  .configure(auth({ storage: window.localStorage }))
  .configure(rx(RxJS, {idField: '_id'}))
  .configure(feathersVuex(store, feathersVuexOptions, feathersVuexModules))
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Proposal] Allow existing store modules to provide additional ...
I'd like to propose adding a flag to the vuexOptions object (perhaps respectExisting ) that would instruct new service-modules to take on the...
Read more >
Properties for XModules - Tosca
Both XModules and XModuleAttributes are defined by their default properties. In addition, they are also defined by using specific parameters. These params are ......
Read more >
Extensions for Zoho Desk | Developer guide
Tightly integrate Zoho Desk with your favorite business tools. Get an overview of what an extension is and the types of extensions available...
Read more >
OnBase Certified Admin Handbook
Goal: To provide new OnBase certified admins with details of ... More information is available in the Unity client, Workflow and.
Read more >
3D Slicer Documentation - Read the Docs
Describe what assistance you can offer for the implementation (your own time, funding, etc.). 3.4 I would like to let the Slicer community...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found