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

Ability to control merge of metadata? #3709

Closed
dortort opened this issue Aug 27, 2015 · 3 comments
Closed

Ability to control merge of metadata? #3709

dortort opened this issue Aug 27, 2015 · 3 comments

Comments

@dortort
Copy link

dortort commented Aug 27, 2015

Meta in a response may contain both constant and temporary data that relates only to the given query.
It would be nice to be able in such a case to define which properties are merged and which are simply returned in the response of store.query().

I have the following use case:
My API returns in its meta a total with the total count of objects in the collection and, when the query is filtered (store.query('model', { filter: ... })) a filtered count of the number of objects that meet the filter criteria. I see no reason to persist the filtered count in the store's metadata is such a case. Furthermore, given that the filtered property is not present when the request is not filtered, the (currently merged) meta returned in the response is misleading.

Should the merge behaviour of metadata be optional/ overideable? Defined in the serializer/ adapter?

@pangratz pangratz added the meta label May 27, 2016
@wecc
Copy link
Contributor

wecc commented Oct 22, 2016

Sorry for the late response.

For JSONSerializer and RESTSerializer you should be able to munge the meta in normalizeQueryResponse if you want to remove it in certain code paths but not others. Would that solve this issue?

For JSONAPISerializer we still haven't implemented full meta support but I guess the same (above) would apply here.

@stefanpenner
Copy link
Member

👍

@hjdivad seems related to our work

@runspired
Copy link
Contributor

We no longer merge meta at all, it is a simple direct assign of whatever the latest meta given to us is. If you do want to merge, this is something you can achieve on your own by accessing the previous meta and merging prior to giving us the new meta.

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

No branches or pull requests

6 participants