Giter Club home page Giter Club logo

Comments (11)

tomkis avatar tomkis commented on May 18, 2024 2

Thanks @minedeljkovic and @namjul

I'd agree that this should definitely be part of the framework. IMO tagged dispatch should be memoized, so I'd just change implementation of forwardTo.

from prism.

namjul avatar namjul commented on May 18, 2024

you could also use https://github.com/acdlite/recompose/blob/master/docs/API.md#onlyupdateforkeys and just not include dispatcher.

from prism.

minedeljkovic avatar minedeljkovic commented on May 18, 2024

Thanks, @namjul !
I didn't check their API in enough detail. Would onlyUpdateForKeys() also ensure that call to dispatch from wrapped component will be properly delegated to latest instance, despite wrapped component not being rendered with it? Also general behavior for redux-elm views would be to update for all keys except dispatch but that can probably be achieved by some function from recompose api.

But, final question still remains. Since redux-elm is opinionated with usage of dispatch (it comes with forwardTo) and immutability of model, shouldn't this be also included out of box?

from prism.

minedeljkovic avatar minedeljkovic commented on May 18, 2024

Great! Looking forward to see that implementation.
I must confess I tried that approach, but all I came up with was pretty cumbersome to use in components like gif-viewers-pair and gif-viewers-dynamic-list. Hope it will not be that way. :)

from prism.

namjul avatar namjul commented on May 18, 2024

@minedeljkovic i think it will just use the instance of dispatch it got initially.

from prism.

minedeljkovic avatar minedeljkovic commented on May 18, 2024

Thanks, @namjul . That would not be good for this case.

from prism.

namjul avatar namjul commented on May 18, 2024

so in your case your forwardTo function isn't static and it can change based on some logic.

from prism.

minedeljkovic avatar minedeljkovic commented on May 18, 2024

Yes, I think that is generally the case in redux-elm. Take for example gif-viewers-dynamic-list. Components in dynamic list could be reordered so their dispatch path would change.

from prism.

namjul avatar namjul commented on May 18, 2024

oh right .. missed that one :)

from prism.

namjul avatar namjul commented on May 18, 2024

@minedeljkovic FYI actually "onlyUpdateForKeys" should also return the latest dispatch function. So whenever shouldUpdate returns true, the current dispatch function is used.
https://github.com/acdlite/recompose/blob/master/src/packages/recompose/onlyUpdateForKeys.js

from prism.

tomkis avatar tomkis commented on May 18, 2024

Solved in #14

from prism.

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.