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

Store fetch dependsOn not working as described? #113

Closed
dandelany opened this issue Feb 6, 2015 · 2 comments
Closed

Store fetch dependsOn not working as described? #113

dandelany opened this issue Feb 6, 2015 · 2 comments

Comments

@dandelany
Copy link

Hi! Having fun experimenting with Marty, thanks for making it! But I ran into something I haven't been able to figure out...

According to the Store docs, I can pass a dependsOn option to fetch() which is a dependency fetchResult or array of fetchResults. This way "It will only try and start fetching the data when all dependencies are done."

When I try to do this, the dependency fetch works and gets resolved correctly, but the "parent" fetch (the one with dependsOn) does not seem to ever finish fetching after the dependency is finished - it has a permanent PENDING state. If I wait until the dependency is done and then try the original fetch again, it does get resolved - but this of course defeats the purpose because I have to know when the dependency is done.

I tried stepping through the code but I don't fully understand fetchResult yet... Any ideas? I put together a contrived example in this Gist: https://gist.github.com/dandelany/abac7290bce588f9a709 In the example, FriendStore.getAll() depends on UserStore.getAll(). UserStore.getAll() finishes and has a state of "DONE" but FriendStore is still "PENDING".

@jhollingworth
Copy link
Contributor

Hey, the problem is the state mixin was only bound to the friend store so the component wouldn't re-render when the user store re-renders. This fiddle shows a working example.

That said I think this is a missing feature in Marty. The Friend store should emit a change when any dependent fetches are complete. I will try and implement that over the next few days

This was referenced Mar 8, 2015
@jhollingworth
Copy link
Contributor

Sorry its taken so long but #182 has fixed this. This will be released in v0.9 (#137)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants