jamesplease / jamesplease/redux-resource
Version tracking for resource types
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 232
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Hey everyone! Just wanted to say that you've done a great job with this library. I've actually built a pretty robust auto fetch framework using redux-resource, which we would like to open source in the near future.
With that said, we handle relatively complex state in our application, and I'm sure many consumers of redux-resource in general do.
Because state diffing can be very expensive and can result in many extra render cycles, I would like to propose a new attribute on the default redux-resource schema. That attribute would be a "version" which is just an atomic incrementing integer that increments each time a Create/Read/Update/Delete is performed on that given resource's state (including PENDING/FAILED requests). With this implementation, two versions could technically result in the same state version, but it is ideal in that two _successive_ versions cannot have the same state. You are basically treating the state like a changeset based database, which it very much is. It also allows consumers to implement a simple `areStatePropsEqual` function that difs the versions for any resource types that the given component is listening to, resulting in no actual state diffing but an O(1) determination as to whether or not it should pass props on to the underlying component and perform a full render cycle.
Our AutoFetchFramework leverages a custom implementation of this functionality, and it works incredibly well. We are able to manage hundreds to thousands of complex resources with many attributes across dozens of resource types with no extra render cycles using this simple implementation.
If you are open to the above ^ I would be happy to open up a PR!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the default redux-resource schema and the resource state transitions for Create, Read, Update, and Delete requests, including PENDING and FAILED states. Done would mean agreeing on and implementing version behavior for each resource type, with coverage for the proposed successive-version guarantees; the issue names no files or tests to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100