Repository navigation
Feature: per-instance pending status - #528
marshallswain merged 21 commits into
Conversation
|
Added tests for state, mutations and getters. Still need:
|
|
Added tests for actions and BaseModel Still need to add documentation. |
|
A Map would have been nice for that... Maybe when Vue 3 will be the main supported version.... |
|
I like it! That's pretty awesome. I looked into it and have three annotations:
|
@J3m5 could you help me understand how a map would be used here where an |
|
Thanks for the feedback @fratzinger !!
Or do you mean the patch/update/remove actions should all handle multi and pass all IDs to
I like this. Should just be an or of create/patch/update pending status? And should we keep
Yeah this should be easy and a straightforward addition. |
okay, perfect. As
I did not think of that. I think that's what the service-wise
It's hard find the cut between to too little and too much sugar 😄 For me
Maybe we can implement this after this PR, I don't know. Let me know, if I can help :) |
|
Looks exciting, y'all! Let me know when you are ready to merge! |
|
I've added In my opinion, per-instance error handling should be a separate PR. Marking this ready for review. |
|
Finally getting this merged. Thank you! This adds huge time-saving features. |
Summary
Adds per-instance, per-method pending status to FeathersVuex per discussion in #518
PR includes new state, new getters, new mutations, new
BaseModelgeters, and modifies the actions forcreate,update,patchandremoveto call the new mutations.What Problem am I Solving?
Currently, FeathersVuex tracks
pendingstatus forcreate,update,patchandremoveper service... but only in an all-or-nothing way. This means that if any model is pending, the status for that service is set. As expressed in #518, it can be useful to have a status for this model is patching and that model is removing, or similar.In my opinion, the most useful new thing in this PR is that the
BaseModelnow has the followinggeters:isCreatePendingisUpdatePendingisPatchPendingisRemovePendingisPending-trueif any of the previous four statuses aretrueImplementation
I decided to use
Arrays ofids in the Vuex state for maintaining the pending status. I chose to useArrays instead ofObjects because for eachid, if a method is called multiple times, an Array can track that there are multiple requests in progress and therefore the status will not clear until the last request finishes.I decided to make the status part of the Vuex state instead of part of the Model class to keep the status in-sync between clones and originals. E.g. when a clone is modified and
patched, the original model's status indicates that apatchis in progress.❤️