Skip to content
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

Feature request: Undo functionality #82

Closed
robertherber opened this issue May 30, 2017 · 3 comments
Closed

Feature request: Undo functionality #82

robertherber opened this issue May 30, 2017 · 3 comments

Comments

@robertherber
Copy link

I'm building a offline-first React Native app using redux-offline. Right now I'm trying to find the best way to provide undo functionality (if there's a good way to do this already please let me know). What I'm suggesting is something like this:

  1. A configurable delay before the first request is fired when online (let's say 10 seconds).
  2. Expose an undo action creator that (a) triggers an action for the redux-offline reducer to remove the most recent item in the outbox and (b) triggers the rollback action with the associated metadata of that item.
  3. Expose a selector that indicates whether an undo is possible (i.e. there's at least one item in the outbox that has not yet triggered a request to the server).
@wacii
Copy link
Collaborator

wacii commented Nov 11, 2017

A bit late, but this is not something I am interested in adding.

@wacii wacii closed this as completed Nov 11, 2017
@robertherber
Copy link
Author

@wacii Could you give an idea on how to achieve this functionality at least? If I could just trigger an action that removed the last added item from the outbox I'd be happy. The rest I could take care of easily.

@wacii
Copy link
Collaborator

wacii commented Nov 25, 2017

There is no action for that, you would have to add one yourself. By default, the offline actions are stored in an array at state.offline.outbox. If you wanted to remove the latest offline action, just get rid of the last item in that array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants