Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A join*any option #170

Open
fskreuz opened this issue Dec 17, 2014 · 7 comments
Open

A join*any option #170

fskreuz opened this issue Dec 17, 2014 · 7 comments

Comments

@fskreuz
Copy link

fskreuz commented Dec 17, 2014

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.

@spoike
Copy link
Member

spoike commented Dec 17, 2014

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.

@gabadi
Copy link

gabadi commented Jan 11, 2015

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

@gabadi
Copy link

gabadi commented Jan 12, 2015

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

@spoike
Copy link
Member

spoike commented Jan 13, 2015

@gabadi It's OK. 👍

@gabadi
Copy link

gabadi commented Jan 25, 2015

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

@dtinth
Copy link
Contributor

dtinth commented Dec 19, 2015

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!

@nidu
Copy link

nidu commented Jan 12, 2016

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
Projects
None yet
Development

No branches or pull requests

5 participants