Closed maimake closed 6 years ago
So what is currently happening, and what did you want to happen, and why? How is it different from mapActions?
Can you outline your use-cases with example code?
I ran into this today. Snippet of code:
methods: {
...call([
'benchmarks/loadBenchmarks',
// 'data/loadScan', // Using this will cause the .then to fail in onSelectScan because nothing is returned
]),
...mapActions('data', [
'loadScan', // This will work properly though
]),
onSelectScan(side, scan) {
// Fully load scan
this.loadScan({ id: scan.pk, truncate: true }).then(scan => {
if(side === 'old')
this.oldScan = scan;
else
this.newScan = scan;
this.loadBenchmarks({ benchmarkIds: scan.benchmark_ids });
});
},
}
I believe all it takes to fix this is changing https://github.com/davestewart/vuex-pathify/blob/892e2403794521c4dcd18242932768dbb21bc6de/src/helpers/component.js#L152 to be return this.$store.dispatch(path, value)
. According to https://vuex.vuejs.org/guide/actions.html#composing-actions, this returning a Promise thing is the normal vuex action behavior.
I can submit a PR if needed. I just started using Pathify, but it's great so far!
Oh, sorry - that's certainly an oversight! It should absolutely be returning the promise!
Let me patch and submit.
Glad you're enjoying it!
Fixes 03079f458afda39a3524816b3f785ae05c9c1762
Fix isn't published on NPM.
See: https://github.com/davestewart/vuex-pathify/commit/03079f458afda39a3524816b3f785ae05c9c1762
waiting for this
There's an issue with getting it published (see discussion on the commit). For now, just use mapActions()
. It'll be a drop-in replacement once updated.
@davestewart Can not be fixed ?
Sorry for the wait, working very long days right now! Let me get in touch with NPM and see what they say
OK, I think I must have been patching and building in the wrong order. I've just checked unpkg and it looks like it has published correctly!
Confirmed working for me now. Thanks!
The Component helper fun
call()
should create functions which should be return promise asmapActions
, Thx