Differentiate results
See original GitHub issueI like the approach of this package and the simplicity on how it works.
Edit I tested a lot and simplified this issue based on my tests:
Please look at following situations to understand my issue:
- Situation A:
I need to
find
a list of data sets based on different query options. If I wanted to display two lists of data sets on the same page I would need to have two reducers right now in order to distinguish the results and to prevent them from being overwritten. - Situation B:
I
get
a data set from the server. I have an error message field which should print a warning if the data could not be fetched. When the data was successfully fetched from the server I want to change it somehow. So I do anupdate
. If theupdate
failed and I now go back to my preview of the data I get an error message which I can’t tell if it was from theget
or theupdate
, so I have to add additional state to distinguish. - Situation C:
I
find
an array of data sets from my server which give me basic information about my entries. I now want toget
each entry of the same endpoint afterwards and load them into my view so that my application doesn’t hang and the user wouldn’t need to wait until all of the data was fetched before he could interact with the UI. How should I get both the result of thefind
and all results ofget
into the state?
So here are some possible solutions:
- Solution for situation A: You could set something like a ‘namespace’ in the action to let the reducer know in which substate the result should be put. This would give the user most control about the data but would cause a lot of substates which may never be reused afterwards. I also don’t think that this would be redux conform as you would modify the way the reducer works in the actions which should be prevented if possible.
services.myService.find/get/...('namespaceA', data);
services.myService.find/get/...('namespaceB', ...);
myService: {
namespaceA: {
isError, isLoading, isFinished, data, ...
},
namespaceB: {
isError, ...
}
}
- Solution for situation B: You could add a field like ‘method’ to the state.
services.myService.get(...);
myService: {
method: 'get',
isError,
data: { entryData },
...
},
- Solution for situation C: A mechanism to inject the result into queryResult?
Please let me know what you think about this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
Differentiated Results - Models Method
One of the first things a business usually tries to do is find a way to differentiate their product or service … What...
Read more >Q: What is the difference between findings and results? - Editage
Technically or academically speaking, 'findings' seems to be used more for qualitative studies whereas 'results' seems to be used more for ...
Read more >What's the difference between results and discussion? - Scribbr
The results simply and objectively reports what you found ; the discussion interprets the meaning of the results and explains why they matter....
Read more >Showing explicit and implicit differentiation give same result
Sal gives an example of how implicit differentiation results in the same derivative expression as direct differentiation. Created by Sal Khan. Sort by:....
Read more >Differentiation using standard results - YouTube
Differentiation using standard results is an alternative and direct way of finding gradient of a curve. In this video i have made a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any update on this? The base functionality is great, but Situation A is really common.
Edit - Ended up using the following, seem to provide the functionality I was after.
Just want to let you know I’m still thinking about it.