ember-fastboot / ember-fastboot/ember-cli-fastboot
Storing associated records on the shoebox using JSONAPI
- Dominant language
- JavaScript
- Stars
- 850
- Forks
- 161
- Avg merge
- 17h 45m
- Merged PRs (30d)
- 19
Description
Hi,
I'm starting to use fastboot on my application, and I'm trying to reduce model fetch calls on my routes. Storing models in the shoebox is simple if models are do not have associations, but some of my routes depend on records that have associated records.
I tried to store the main record and all associated records in the shoebox, but this is not trivial. I'm using JSON API, and the specification doesn't allow embedded serialization of associated records. Also, I don't want to change my main serializer for my the main record type, since changing it will affect how my Ember app will interact with my API server.
I tried circumventing this problem by creating a different serializer extending from `JSONSerializer`. I was able to serialize the main record in regular JSON format, but there is no simple way of overriding associated records serializers when serializing from the main object.
Which is the best way to handle this case? It would be great not to reload everything on the model after the first render.
Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.