Git Product home page Git Product logo

Comments (5)

nilsmehlhorn avatar nilsmehlhorn commented on May 30, 2024 1

You need to put any actions that can be undone/redone into allowedActionTypes. You can then also put some of them into mergeActionTypes in order to undo/redo them in whole when actions of a single type occur directly after each other. A good example for this are sliders, have a look at the example in the readme.

Either way, all actions for undo/redo need to be in allowedActionTypes. Leaving it empty will make all actions undoable/redoable. Hope this is clear, otherwise don't hesitate to ask again.

I would be nice if you could give this library a star when it's working for you :)

EDIT: Ah, I see your error now. I'll look into it.

EDIT2: When I corrected your StackBlitz to use only allowedActionTypes the error was next is undefined & state is undefined. And that was exactly the case for your setup: you didn't provide an initial state. Here's a fixed StackBlitz: https://stackblitz.com/edit/angular-fitmtz

from ngrx-wieder.

nilsmehlhorn avatar nilsmehlhorn commented on May 30, 2024

Can you provide more information or a reproduction on https://stackblitz.com/ or similar?

How are you integrating the library and what exactly is not working properly? Which versions of Angular, NgRx and ngrx-wieder are you using?

from ngrx-wieder.

vm2geo avatar vm2geo commented on May 30, 2024

Here is the stackblitz example https://stackblitz.com/edit/angular-xqf5h9. Doing in the stackblitz worked, because i copied exactly like in your example. Maybe i was not seeing the error, but I noticed that you must use "mergeActionTypes" to work and not "allowedActionTypes", maybe i undestand wrong the documentation because english it's not my first language.

from ngrx-wieder.

vm2geo avatar vm2geo commented on May 30, 2024

Ok, that was exactly the problem, i wasn't passing the initial state to the reducer. And passing the initial state i was able to use the allowedActionTypes. Thanks for this library, worked perfectly in my project that uses OpenLayers, i was able to undo and redo the zoom and the center of the map

from ngrx-wieder.

nilsmehlhorn avatar nilsmehlhorn commented on May 30, 2024

Great to here that it worked out! I'll soon update the library to be in line with the new ngrx functions like createReducer. Some things changed with the new NgRx version and I'll have to see how to deal with that.

Sounds like a cool use-case, your welcome to share a link once it's public. This way people can see some examples of the library in action.

from ngrx-wieder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.