Skip to content

A join*any option #170

Open
Open

Description

There's this case where I have an array of contacts in one store, and an array of ids in another store (selected contacts). Then there's a third store that merges the two, adding isSelected to the contacts whose id exists in the second store.

Now with joins, this becomes trivial. However, joins require all event sources to fire before firing the handler. If I only changed the second store, it won't fire the join on the third store. The effect is that views depending on the third store will not update because the first store didn't update anything yet.

Is there a way to fire the handler when any of the event sources trigger? I once did this by manually listening to changes, caching the data, and firing a remapper function. But it would be nice if this was baked into Reflux.

Activity

  1. spoike commented on Dec 17, 2014

    @spoike
    Member

    Yeah, I've been doing this manually as well. I don't know if joins is the right pattern for this since it will yield undefined/null values. Maybe there is a better pattern for this? I'd love (:heart:) to hear other ideas for this "remapping" use case.

  2. gabadi commented on Jan 11, 2015

    @gabadi

    Can't be a joinCombine?
    like baconjs combine: https://github.com/baconjs/bacon.js/wiki/Diagrams
    and like was proposed in this post: #55

    That could be really useful

  3. gabadi commented on Jan 12, 2015

    @gabadi

    I need the feature and i can try to make a pull request, but i need to know if that would be ok

  4. spoike commented on Jan 13, 2015

    @spoike
    Member

    @gabadi It's OK. 👍

  5. gabadi commented on Jan 25, 2015

    @gabadi

    till now i didn't arrive to something that is good enough. If i've something i'll do a pull request

  6. dtinth commented on Dec 19, 2015

    @dtinth
    Contributor

    I just implemented Reflux.waitFor() which is available in reflux-waitfor npm package.

    This way, the store will be listening to the action directly (instead of listening to other stores). Now, in your store’s action handler, it can ask Reflux that the action be delivered to some other store (synchronously) first.

    Hope you (or anyone who stumbles upon this issue) find it useful!

  7. nidu commented on Jan 12, 2016

    @nidu

    So is this one abandoned? What solution did you choose? Just introduced baconjs into the application?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions