Giter VIP home page Giter VIP logo

Comments (3)

cormacrelf avatar cormacrelf commented on September 16, 2024

You can still use immutable data structures without ngrx. It makes programming this easier. Use the “immer” library, it’s only like 2kB. The morphing quiz example does this, I believe.

As for hover, the way it’s implemented in the examples with immutable lists is that you have to produce a new version of the list-of-lists. To preserve cancel-ability, you keep the old one around, and it simplifies things to implement hover with the same code that moves things for real, because the requirements of hover are pretty much identical to moving:

  • a normal move, usually done in drop that takes the old list-of-lists and moves the card, producing a new list-of-lists
  • a hover, which takes the old list-of-lists and moves the card to exactly the same place (“under the mouse”), producing a new list-of-lists

You don’t have to do that, you could always just “move it back” to cancel, but cancelling is way easier when you do it this way.

I’m not going to code up what it looks like when you just mutate lists in flight, because it’s painful and frankly a waste of time. If any clojure developers looked at Dragula/ng2-dragula and this list-mutating madness, they would have to put their spaceships on autopilot for a moment to fall over laughing. Yes it could be done, but save yourself the trouble.

from angular-skyhook.

killface avatar killface commented on September 16, 2024

Thanks for getting back to me so quickly. I'll give Immer a shot today, and hopefully save myself a headache and learn something as well.

Also, I notice Immer's readme has a button for buying the developer a coffee to say thanks. I don't know how you feel about asking for donations, but some of us do like to thank the good people like you who make our lives easier with these public projects.

from angular-skyhook.

cormacrelf avatar cormacrelf commented on September 16, 2024

@killface looks like I thought about it 8 months ago but never added a button. It's a good idea.

Hope you figured out your thing.

from angular-skyhook.

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.