charkour / zundo

🍜 undo/redo middleware for zustand. <700 bytes
https://codesandbox.io/s/zundo-2dom9
MIT License
616 stars 20 forks source link

check if there are any undo steps #181

Closed hsavit1 closed 2 months ago

hsavit1 commented 2 months ago

thanks for making this very useful lilbrary!

id like to disable my undo button if there are no undo operations to perform. similarly id like to disable the redo button if there are no futureStates. I think this would be a nice convenience method on the library to do this check

charkour commented 2 months ago

Thanks for the kind words!

You can disable undo button if there are no pastStates and disable the redo button if there are no futureStates.

https://github.com/charkour/zundo#going-back-in-time