Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/shaky-queens-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@graphql-codegen/typescript-react-query': patch
'@graphql-codegen/typescript-solid-query': patch
---

Query keys should be shared between suspense and non-suspense hooks to ensure consistent state
management and synchronization, preventing discrepancies and maintaining a single source of truth
for query invalidation.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup env
uses: the-guild-org/shared-config/setup@main
with:
nodeVersion: 18
nodeVersion: 24
- name: Prettier Check
run: yarn prettier:check
dev-tests:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
uses: the-guild-org/shared-config/.github/workflows/release-stable.yml@main
permissions:
id-token: write # allows ODIC publishing
contents: write
with:
releaseScript: release
nodeVersion: 24
Expand Down
5 changes: 1 addition & 4 deletions packages/plugins/typescript/react-query/src/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ export abstract class FetcherRenderer {
>(${argumentsResult}) => {
${implHookOuter}
return ${query.getHook()}<${operationResultType}, TError, TData>(
${this.generateQueryFormattedParameters(
this.generateQueryKey(config),
implFetcher,
)}
${this.generateQueryFormattedParameters(this.generateQueryKey(config), implFetcher)}
)};`;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ export const useSuspenseTestQuery = <

return useSuspenseQuery<TestQuery, TError, TData>(
{
queryKey: variables === undefined ? ['testSuspense'] : ['testSuspense', variables],
queryKey: variables === undefined ? ['test'] : ['test', variables],
queryFn: fetcher<TestQuery, TestQueryVariables>(dataSource.endpoint, dataSource.fetchParams || {}, TestDocument, variables),
...options
}
Expand Down Expand Up @@ -1478,7 +1478,7 @@ export const useSuspenseInfiniteTestQuery = <
(() => {
const { queryKey: optionsQueryKey, ...restOptions } = options;
return {
queryKey: optionsQueryKey ?? variables === undefined ? ['test.infiniteSuspense'] : ['test.infiniteSuspense', variables],
queryKey: optionsQueryKey ?? variables === undefined ? ['test.infinite'] : ['test.infinite', variables],
queryFn: (metaData) => fetcher<TestQuery, TestQueryVariables>(dataSource.endpoint, dataSource.fetchParams || {}, TestDocument, {...variables, ...(metaData.pageParam ?? {})})(),
...restOptions
}
Expand Down
5 changes: 1 addition & 4 deletions packages/plugins/typescript/solid-query/src/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ export abstract class FetcherRenderer {
>(${argumentsResult}) => {
${implHookOuter}
return ${query.getHook()}<${operationResultType}, TError, TData>(
${this.generateQueryFormattedParameters(
this.generateQueryKey(config),
implFetcher,
)}
${this.generateQueryFormattedParameters(this.generateQueryKey(config), implFetcher)}
)};`;
};

Expand Down