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

HasManyReference property _isLoaded return false when it had been loaded once (with empty result) #4845

Closed
twawszczak opened this issue Mar 8, 2017 · 7 comments · Fixed by #5053

Comments

@twawszczak
Copy link

I have an issue with HasManyReference property "_isLoaded". It should return true when relationship had been loaded at least one time, right? But it returns false, when last relationship request returned empty array. (works correct when last request returned more then 0 elements)

https://github.com/emberjs/data/blob/v2.11.0/addon/-private/system/references/has-many.js#L111

@bmac
Copy link
Member

bmac commented Mar 26, 2017

Seems like a bug. What do you think @runspired / @igorT? Should _isLoaded return true when hasData is true and the members array has 0 elements?

@runspired
Copy link
Contributor

seems like a bug

@bmac
Copy link
Member

bmac commented Mar 26, 2017

Actually @twawszczak now that I'm digging into this I'm having trouble reproducing the issue. I created a test for the issue in pr #4891 but its currently passing on the master branch. Would you mind taking a look at my test and let me know if I'm missing something.

Thanks

@twawszczak
Copy link
Author

@bmac i suppose you should assert _isLoaded property value, am i right? This is a problem in this issue.

@bmac
Copy link
Member

bmac commented Mar 28, 2017

I've updated the test to use _isLoaded, however, I'm still seeing it return true. I think I might have something wrong with how I'm getting into the state with an empty array. @twawszczak do you mind taking a look again?

@twawszczak
Copy link
Author

twawszczak commented Mar 29, 2017

@bmac I have loading data from server via JSONAPiAdapter, I don't know how to reproduce it in test suite. :(

@bmac
Copy link
Member

bmac commented Mar 31, 2017

Would you be able to reproduce it using this Ember Twiddle?

hjdivad added a commit that referenced this issue Jul 12, 2017
See #5053 for a similar fix in the fetchLink case.  See #4845 for the
initially reported bug.
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

Successfully merging a pull request may close this issue.

3 participants