This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
fix(optimization): limit fields retrieval for user #188
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was suggested at apollographql/meteor-integration#118
This package, purposely, only adds a
userId
, so the developer can decide themselves what else they want to fetch from the user. This means we only need to retrieve the ID and the resume tokens for validation.If the developer wants to add user data to the context, they can simply add it via a custom context:
One might argue that this would cause 2 requests instead of one, but in my opinion it's way more flexible and will only actually retrieve the data that is required. 2 small requests might still be faster then one large? Besides, you might only need user data in certain resolvers, so it might be even better to only query in those resolvers (using DataLoader for deduping).
userId
says something about authentication. User data should be retrieved like you would with any other data.In this particular package it's also the case that DDP only offers a userId. By only offering a userId in the HTTP flow we can handle both the same way.
This all also prevents issues like mentioned here: apollographql/meteor-integration#119