-
Notifications
You must be signed in to change notification settings - Fork 995
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
fix: Fixes Unknown Fragment issues due to GraphQL Tag type mismatch in web #10357
Conversation
@dthyresson can I help with this? |
Sorry for the delay - "if trusted documents uses fragments seeing an intermittent Apollo issue. Investigating." ^^ I just need to confirm TD's with fragments was still working ok in a test project. |
|
Steps to reproduce:
In import type { GetArticles } from 'types/graphql'
import { Metadata } from '@redwoodjs/web'
import { useQuery } from '@redwoodjs/web'
import { registerFragment } from '@redwoodjs/web/apollo'
registerFragment(gql`
fragment PostInfo on Post {
id
title
}
`)
const GET_ARTICLES = gql`
query GetArticles {
articles: posts {
...PostInfo
createdAt
# Include other fields specific to this query
}
}
`
const ArticlesPage = () => {
const { data, loading } = useQuery<GetArticles>(GET_ARTICLES)
return (
<>
<Metadata title="Articles" description="Articles page" />
<h1>ArticlesPage</h1>
{!loading &&
data.articles.map((post) => (
<div key={post.id}>
{post.title} @ {post.createdAt}
</div>
))}
</>
)
}
|
@Josh-Walker-GM Requested review as you had helped some of these setups. Also, will need a patch release. Thanks! |
Original issue reproduction:
for the ArticlesPage, use the following code: import type { GetArticles } from 'types/graphql'
import { Metadata } from '@redwoodjs/web'
import { useQuery } from '@redwoodjs/web'
import { registerFragment } from '@redwoodjs/web/apollo'
const POST_FRAGMNET = gql`
fragment PostInfo on Post {
id
title
}
`
registerFragment(POST_FRAGMNET)
const GET_ARTICLES = gql`
query GetArticles {
articles: posts {
...PostInfo
createdAt
# Include other fields specific to this query
}
}
`
const ArticlesPage = () => {
const { data, loading } = useQuery<GetArticles>(GET_ARTICLES)
return (
<>
<Metadata title="Articles" description="Articles page" />
<h1>ArticlesPage</h1>
{!loading &&
data.articles.map((post) => (
<div key={post.id}>
{post.title} @ {post.createdAt}
</div>
))}
</>
)
}
export default ArticlesPage
|
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.
Paired with @dthyresson on this and confirmed it fixes the type issue.
…n web (#10357) Fixes: #10322 See ^^^ --- Tested that both the graphql toml config with fragments and trustedDocuments set to true works. However, if trusted documents uses fragments seeing an intermittent Apollo issue. Investigating. Update: Have confirm that if trusted documents uses fragments, works as expected. See note below. Note: Had to make small fix to fragments setup to address an error when prettifying as final step.
…n web (#10357) Fixes: #10322 See ^^^ --- Tested that both the graphql toml config with fragments and trustedDocuments set to true works. However, if trusted documents uses fragments seeing an intermittent Apollo issue. Investigating. Update: Have confirm that if trusted documents uses fragments, works as expected. See note below. Note: Had to make small fix to fragments setup to address an error when prettifying as final step.
…g-gen-mw-p2 * 'main' of github.com:redwoodjs/redwood: fix(deps): update React to latest canary 19.x (#10496) fix(upgrade): Download yarn patches (#10497) Revert React 19 upgrade (#10482 and #10491) (#10495) Modified type for describeScenario (#10468) fix(upgrade): Download yarn patches (#10491) fix(deps): update React to latest canary 19.x (#10482) chore(dataMigrate): Fix package.json directory value (#10490) RSC: css preinit: Add required option precedence (#10481) chore(renovate): Remove config for unused package (#10489) RSC: Update test projects to use new @apollo/client-react-streaming (#10488) RSC: Remove unused vite patch from test-project-rsa (#10487) chore(ssr): Switch to use `@apollo/client-react-streaming` package (#10484) chore(docs): Move .mdx import into separate file (#10486) fix(cli): avoid `npx` during upgrade command (#10479) fix: Fixes Unknown Fragment issues due to GraphQL Tag type mismatch in web (#10357) RSC: Clean up some comments and logs (#10480) feat: redwoodjs/auth-dbauth-middleware - Part 2/3 - Auth Middleware for dbAuth to authenticate users via cookie (#10447)
Fixes: #10322
See ^^^
Tested that both the graphql toml config with fragments and trustedDocuments set to true works.
However, if trusted documents uses fragments seeing an intermittent Apollo issue. Investigating.
Update: Have confirm that if trusted documents uses fragments, works as expected. See note below.
Note: Had to make small fix to fragments setup to address an error when prettifying as final step.