-
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
Support custom directives in InMemory Cache #2710
Support custom directives in InMemory Cache #2710
Conversation
@neoziro: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
Generated by 🚫 dangerJS |
87d6548
to
59e3da4
Compare
59e3da4
to
ab02083
Compare
Object.keys(directives).forEach(key => { | ||
if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; | ||
if (directives[key] && Object.keys(directives[key]).length) { | ||
completeFieldName += `@${key}(${JSON.stringify(directives[key])})`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, how about directives arguments? Should put it in the key too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually they are! directives[key]
contains arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the keys in JSON.stringify(directives[key])
be pre-sorted into a consistent order? Right now, they'll hash in undefined order, no?
@neoziro NICE! This is great! Can you fix the conflicts in the authors file and rebase on master? Happy to get this in! |
ab02083
to
5a5d3ec
Compare
@jbaxleyiii done |
@jbaxleyiii the CI seems broken, |
@neoziro odd! Can you rebase this on top of master? That should fix it and I can merge in for the next release! |
Before this change, using a custom directive corrupted the cache. It is now possible to safely use a custom directive without breaking it. Example of custom directives: https://github.com/smooth-code/graphql-directive
5a5d3ec
to
bfcd499
Compare
@jbaxleyiii done |
@jbaxleyiii can you merge it? |
…ographql#2710)" This reverts commit de38f3c.
Unpublished 1.1.6 due to #2710 breaking link-state
Unpublished 1.0.7 due to #2710 breaking link-state
@peggyrayzis do we have a solution to make it works? Also it looks like a test was missing in |
Before this change, using a custom directive corrupted the cache.
It is now possible to safely use a custom directive without breaking it.
Example of custom directives: https://github.com/smooth-code/graphql-directive
Closes #2709