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

How do people handle different api calls updating the same entity #60

Open
stueynet opened this issue Aug 6, 2018 · 1 comment
Open

Comments

@stueynet
Copy link

stueynet commented Aug 6, 2018

Currently the problem we have is that if we populate a list by making a query and including relationships, if somewhere else on the screen you may make a different call with different requested relationships, the top level entity is updated with the new relationship. So if your original query populated a table, for example, and accessed those relationships, things break down because now one entity in that list no longer has the relationships it originally had.

To simplify lets say you make a call to get posts with comments included. So you end up with

Get all posts with comments

entities

  • post 1
    • comments array
  • post 2
    • comments array
  • post 3
    • comments array

But on the same screen perhaps post 2 gets update via another query with a different requested shape like

Get a single individual post with author

So now your top level entities has:

entities

  • post 1
    • comments array
  • post 2
    • author
  • post 3
    comments array

So the table that was originally populated with posts and something related to comments will break because suddenly comments disappear from one of those top level posts.

@MrLeebo
Copy link

MrLeebo commented Sep 7, 2018

I think you would either update your endpoints so that both include comments, or you would expose them as different types (e.g. short_posts and full_posts) so they don't collide with each other.

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