-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Enable data masking in cache instead of client #12019
Conversation
|
b8fb05e
to
311eb6d
Compare
Discussed with @phryneas and we think that moving masking into the This is a point we will hope to gather feedback on during an experimental release to see if this ends up too confusing or not. As such, we'll keep the config value where it is. |
Currently you enable
dataMasking
by setting the option in theApolloClient
constructor. While this has worked well throughout the development of this feature, this approach does not work very well when using thewatchFragment
API to mask fragment data returned from that method. That method needs to check whether to mask the raw cache data or leave as-is and it has no way of doing that with the current setup.We approached this earlier in #11891 which used the
ApolloClient
constructor to inform the cache when the option was enabled. This however was clunky and thus moved in #11913 which was a more natural API. Unfortunately #11913 now again makes it difficult to determine in the cache whether masking is enabled in the cache. For the cache to determine whether masking is enabled, we'd need to revert back to a solution like #11891. At this point though this seems like a really roundabout way to avoid configuring this option in the cache itself. Instead, I'm proposing we move this configuration to the cache.This approach will still work for any other cache implementation. Those cache implementations can implement the necessary API to use this feature and provide its own interface for enabling masking for its end users.