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

cacheControl hints only propagated on root fields when using schema stitching #505

Closed
kbrandwijk opened this issue Nov 26, 2017 · 6 comments

Comments

@kbrandwijk
Copy link
Contributor

Using makeExecutableSchema shows cacheControl hints on all fields, using mergeSchemas only shows cacheControl hints on root fields:
https://launchpad.graphql.com/r9lmrp989n correctly shows (with cacheControl enabled):

"cacheControl": {
      "version": 1,
      "hints": [
        {
          "path": [
            "myTest"
          ],
          "maxAge": 120
        },
        {
          "path": [
            "myTest",
            0,
            "title"
          ],
          "maxAge": 60
        },
        {
          "path": [
            "myTest",
            0,
            "description"
          ],
          "scope": "PRIVATE"
        }
      ]
    }

Now using mergeSchemas instead of makeExecutableSchema gives:

"cacheControl": {
      "version": 1,
      "hints": [
        {
          "path": [
            "myTest"
          ],
          "maxAge": 0
        }
      ]
    }
@mfix22
Copy link
Contributor

mfix22 commented Jan 5, 2018

@stubailo I am interesting in helping contribute to this. I saw a lot of issues that are similar to this (a combo of directives + stitching), and I am wondering if there is any active work being done?

Do we already know where the gaps exist? Thanks! 😄

@BassT
Copy link
Contributor

BassT commented Jan 8, 2018

I think I solved the reason causing this issue in PR #569. Can you confirm that recreating astNode property solves your issue?

@kbrandwijk
Copy link
Contributor Author

@BassT I'll test it using your PR and report back.

@mfix22
Copy link
Contributor

mfix22 commented Jan 9, 2018

I just tested locally on v2.17.0 and the cache hints were propagated appropriately.

@BassT
Copy link
Contributor

BassT commented Jan 12, 2018

I realized that in v2.17.0 cache hints are only working for GraphQL types. I submitted PR #580, which also makes cache hints work for fields (and therefore queries).

@stubailo
Copy link
Contributor

Going to work on passing through dynamic cache hints as well as part of #890

@mfix22 if you're still interested let's talk soon!

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

5 participants