HN user

omnidan

38 karma

Co-Founder @TouchLay

has a passion for simplicity and structure

redux-undo, coffea and node-emoji maintainer /r/npm moderator, Developer, Web Enthusiast

[ my public key: https://keybase.io/omnidan; my proof: https://keybase.io/omnidan/sigs/3gV7Zxn5QbCoRf2gS103-Y4ZHEucENtMx_UwaXpBKXM ]

https://omnidan.net - https://github.com/omnidan

Posts8
Comments14
View on HN

I think it is too. Its simplicity is what allowed me to create `redux-undo` as it is - it's basically a function that returns a new reducer function which is enhanced with undo-functionality.

So much more can be done with this concept - and it's nothing special - sometimes making things simpler is the best way to solve a problem. Redux is a great example for that.

Amazing. And it even works with Atom :)

Is there a utility that automatically creates the test files in a specific directory? Would be nice to add speckjs to `package.json` so it builds and runs the tests before, for example, publishing. Is something like this possible? Or what would be the best way to automate the generation - is this even what you intended?

EDIT: I just tried it out and it doesn't seem to work for me (I'm probably doing something wrong :D) - would be great if you could help me out: https://github.com/speckjs/speckjs/issues/150

The GitHub API is rate-limited, and this makes a lot of API calls. Don't be surprised if things start to fall apart under load.

Under normal usage (read: not running scripts on GHFS, etc), does GHFS get to the GitHub API limits? Do you use caching? Do you regularly use it to check out projects on GitHub instead of cloning them manually? Did you ever get blocked by the API?

I haven't tested it yet, but it should. The magic behind redux-undo is a reducer enhancer (higher order reducer) - it returns a function that processes undo/redo and then (if appropriate) calls your reducer. If your reducer uses immutable data-structures, redux-undo will simply store your data (immutable or not) in the history.

redux-undo itself doesn't use immutable data structures, though (for dependency reasons). However, I do make sure not to change any data directly. (you know, the usual redux reducer guidelines)

That's an interesting question. The simplest way would be listening to state changes in the store and then syncing the state with the server. Since undos/redos are normal redux actions, you can just handle them like any other action in redux.

For example, in an application I wrote, I do `store.subscribe(autoSaveFunction)` which will automatically save all changes to the state. Of course, you can also only store parts of the state, etc, but this is more redux related than redux-undo related.