-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling offline #41
Comments
good thinkin! this is just a dumb client cache. Handling offline stuff should be handled in your data transport layer. |
We are using a separate request saga with an offline queue for our requests. What happens is that a lot of optimistic BEGIN actions are fired and new requests actions are queued in the offline queue.
Is there a good way to handle these kinds of scenarios. Thank you very much in advance. :-) |
you can remove the error by doing something like making over 100 actions while offline seems like a lot. are you certain they are all dependents of the return value? For example, let's say you use redux for your remote fetches as well as a button hover state. the button hover state is not dependent on the return value of the fetch. you should wrap your fetch reducer with this & leave the button reducer as a vanilla reducer. |
Thanks for getting back @mattkrick. Not sure about the data transport layer part, could you contextualise please? With @BenBach 's case I believe 100 actions is possible without their being a memory leak. I know in my scenario it certainly was (product management system). To try to mitigate it though I debounced network requests to 'batch' the changes. In general I found only the U in CRUD gave me pain. My updates were partial/PATCH (i.e. only rewrote changed fields), but if it were a complete overwrite/PUT then it would be easier. Also I didn't use this library in the end, I used |
Agreed! No one does it well. I had to PR relay to make it work. FWIW, Here's the pattern I use to manage local/optimistic/domain state: |
@mattkrick Yes, that's the way to go about it. Personally I think if that 'network' data and 'local' data were kept separate and the history were encapsulated in both, then it would be a nice improvement to this library (at least in my eyes). Using your already implemented |
Thanks for all the answers. Any help highly appreciated :-) |
@WillSquire i used to do that (local state in redux, domain state in relay) but it's a huge pain. you end up with no single source of truth. sometimes a mutation needs to also mutate the local state (eg animations after a value is returned). @BenBach that doesn't sound right, check your middleware |
Reading through the documentation I can't work out if this has a pooling mechanism for requests and executes in roder or not. I.e. if the connection goes offline, does it wait and retry in the request order or simply fail?
The text was updated successfully, but these errors were encountered: