-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
120 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 22 additions & 8 deletions
30
...ration-test/nextjs/src/app/rsc/dynamic/PreloadQuery/queryRef-useReadQuery/ClientChild.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
"use client"; | ||
|
||
import { QueryReference, useReadQuery } from "@apollo/client"; | ||
import { | ||
QueryReference, | ||
useQueryRefHandlers, | ||
useReadQuery, | ||
} from "@apollo/client"; | ||
import { DynamicProductResult } from "../shared"; | ||
|
||
export function ClientChild({ queryRef }: { queryRef: QueryReference }) { | ||
const { data } = useReadQuery<any>(queryRef); | ||
export function ClientChild({ | ||
queryRef, | ||
}: { | ||
queryRef: QueryReference<DynamicProductResult>; | ||
}) { | ||
const { data } = useReadQuery(queryRef); | ||
const { refetch } = useQueryRefHandlers(queryRef); | ||
return ( | ||
<ul> | ||
{data.products.map(({ id, title }: any) => ( | ||
<li key={id}>{title}</li> | ||
))} | ||
</ul> | ||
<> | ||
<ul> | ||
{data.products.map(({ id, title }: any) => ( | ||
<li key={id}>{title}</li> | ||
))} | ||
</ul> | ||
<p>Queried in {data.env} environment</p> | ||
<button onClick={() => refetch()}>refetch</button> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
integration-test/nextjs/src/app/rsc/dynamic/PreloadQuery/shared.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { TypedDocumentNode, gql } from "@apollo/client"; | ||
|
||
export const QUERY: TypedDocumentNode<{ | ||
export interface DynamicProductResult { | ||
products: { | ||
id: string; | ||
title: string; | ||
}[]; | ||
}> = gql` | ||
env: string; | ||
} | ||
export const QUERY: TypedDocumentNode<DynamicProductResult> = gql` | ||
query dynamicProducts { | ||
products { | ||
id | ||
title | ||
} | ||
env | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ | |
"[email protected]": "18.3.0-canary-60a927d04-20240113", | ||
"[email protected]": "18.3.0-canary-60a927d04-20240113", | ||
"superjson": "1.13.3", | ||
"@microsoft/api-documenter": "7.24.1" | ||
"@microsoft/api-documenter": "7.24.1", | ||
"@apollo/client": "0.0.0-pr-11771-20240409102352" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-documenter": "7.24.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters