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

[Ember Data] load relationships without data or links #266

Closed

Conversation

amiel
Copy link

@amiel amiel commented Oct 31, 2017

@amiel amiel force-pushed the ember-data-load-relationships-without-data branch from 9eba099 to 1d7a854 Compare October 31, 2017 21:54
@locks locks added the T-ember-data RFCs that impact the ember-data library label Feb 28, 2018
@runspired
Copy link
Contributor

Hi @amiel

Sorry for letting this sit so long. A few notes:

  • We've improved relationship state management greatly in recent versions, including ensuring that links are used when necessary and ensuring that we are clear about when we hit network.
  • We definitely should hit network in the no-link, no-data, not-explicitly-empty case; however, it's likely this request is swallowed due to there being no information to use in the query. We are working on a new request management layer and continuing work to refactor the relationship layer, which will help to enable us to ensure a request always happens here with proper context.
  • I think a better alternative to the RFC would be an RFC to ensure that fetching a hasMany with data also uses the findHasMany code-path. Not only would such an RFC help us iterate towards a nicer query management story with this request-manager, it would be able to resolve this corner case elegantly much sooner :) One could imagine that findHasMany would delegate to findMany as it does today in the case where there is no link present, to preserve existing behavior while simplifying the overall flow and enabling this case to be handled.

Thanks so much for digging into this sticky point and pointing out these issues!

@amiel
Copy link
Author

amiel commented Jun 27, 2018

Hi @runspired. Thank you for the response.

I think your idea of

an RFC to ensure that fetching a hasMany with data also uses the findHasMany code-path

would accomplish my goal.

I think it is basically what I meant with

Invert the logic for deciding when to load a relationship by link vs by data (from here)

The main reason I proposed new hooks is to ensure backwards compatibility, in case existing applications were depending on the current behavior of these hooks.

I am in between jobs right now and not in a position to look in to the ins and outs of your suggestion and write a new RFC, so I will bow out at this point, although I may be involved again depending on the nature of my next job :)

Shall I close this PR?

@runspired
Copy link
Contributor

@amiel I think we should close this one in favor of another one, but I hope you can be involved!

@runspired
Copy link
Contributor

Opened an issue for a replacement RFC #356

@runspired runspired closed this Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-ember-data RFCs that impact the ember-data library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants