Skip to content
This repository has been archived by the owner on Nov 16, 2018. It is now read-only.

Automatically retrieve (and cache on the client-side) referenced resources #22

Closed
wimleers opened this issue Jul 26, 2016 · 3 comments
Closed
Milestone

Comments

@wimleers
Copy link
Member

See https://www.drupal.org/node/2282603. HAL+JSON has the notion of _embedded resources. But it embeds just links, not the actual resources. Which means the client must still go and fetch those.

That's annoying. So Waterwheel should do that automatically.

And in doing so, Waterwheel should do client-side caching (much like React's Relay does client-side caching), to avoid re-requesting unchanged resources.


As for the precise implementation: TBD. Perhaps a .getReference([reference_field_name])-style API makes sense? (So you can do entity.getReference('user') to get the author.)

@wimleers
Copy link
Member Author

Also see https://www.drupal.org/node/2282603#comment-11441025 for the exact context/reason for me opening this.

@mattgrill mattgrill added this to the 0.7.0 milestone Aug 3, 2016
@brendan-hurley
Copy link

@wimleers I was wondering what your thoughts are on embedded images - when making the request, the authorization token is added thus triggering a preflight request where origin is different - I don't know about you guys but that kind of came as a bit of a surprise to me as the assets in my nginx config are static and I'm not expecting a preflight. Perhaps it's my own peculiar setup?

@mattgrill
Copy link

I'm going to close this for now. I'm not sure how much effort should be put into waterwheel actually caching responses itself, perhaps your own middleware could handle those needs. If we want to reopen this, with some more context, perhaps around jsonapi that would be great.

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

No branches or pull requests

3 participants