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

Does not work with nested relatiosnhips #44

Open
rsaccon opened this issue Mar 2, 2014 · 3 comments
Open

Does not work with nested relatiosnhips #44

rsaccon opened this issue Mar 2, 2014 · 3 comments

Comments

@rsaccon
Copy link

rsaccon commented Mar 2, 2014

I am working on a custom adapter were the storage is a plain file, and to start with, I have borrowed some code from this adapter, which apparently is based on the indexed-db adapter. So far things work nice if i have simple relationships, lets say root item which has a has-many relationship and its child-items do NOT have its own has-many relationship. If they do have, things don't work anymore, as soon as I try to load those sub-items. I am gonna investigate what exactly will happen and report a solution if I find one. On the other, if you are aware of this issues, let me know how you think it can be solved

@kurko
Copy link
Collaborator

kurko commented Mar 2, 2014

I suppose it's because {async: false}. Ember Data itself is full of bugs with async: true last time I checked. So, what I did here was load all dependencies that are 1 level deeper (resource hasMany resources). I believe you can iterate further in that recursive function, loading deeper levels.

Does that make sense? I believe Ember Data should be smart enough to handle both async or not relationships, but we're not at that point yet.

@kurko kurko closed this as completed Mar 2, 2014
@kurko kurko reopened this Mar 2, 2014
@rsaccon
Copy link
Author

rsaccon commented Mar 2, 2014

kurko, yes that makes sense. And I realised that you are loading just one level deeper (but got confused what happened if go even deeper, adpapter.findMany gets called, as I would expect it to happen in in async mode, but results in an error "cannot call 'resolve' of undefined". So how do I force to go one level deeper ? A counter instead of your recursive flag ?

@kurko
Copy link
Collaborator

kurko commented Mar 3, 2014

Yep, that's how I'd do it, with a counter.

--Alexandre

On Sun, Mar 2, 2014 at 4:51 PM, Roberto Saccon [email protected]:

kurko, yes that makes sense. And I realised that you are actually loading
just one level deeper (but got confused what happened to go even deeper,
adpapter.findMany gets called, as I would expect it to happen in in async
mode, but results in an error "cannot call 'resolve' of undefined". So how
do I force to go one level deeper ? A counter instead of your recursive
flag ?

Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-36464370
.

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