-
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.
0.9.0 (7) - Changes to Data Transport (#223)
* switch data transport to event stream * updates * adjust integration test * tooling config * remove "experimental" from entry point name of manualDataTransport * adjust import * update another import * remove comment * update more references * fixup trigger-rebuild script * more script fixup * tweaks * test error handling * Update packages/client-react-streaming/src/DataTransportAbstraction/WrappedApolloClient.tsx Co-authored-by: Jerel Miller <[email protected]> --------- Co-authored-by: Jerel Miller <[email protected]>
- Loading branch information
1 parent
f823d31
commit 37feeaa
Showing
33 changed files
with
445 additions
and
280 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
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
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
56 changes: 56 additions & 0 deletions
56
integration-test/nextjs/src/app/cc/dynamic/useSuspenseQueryWithError/page.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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"use client"; | ||
|
||
import { useSuspenseQuery } from "@apollo/experimental-nextjs-app-support/ssr"; | ||
import type { TypedDocumentNode } from "@apollo/client"; | ||
import { gql } from "@apollo/client"; | ||
import { ErrorBoundary, FallbackProps } from "react-error-boundary"; | ||
import { Suspense, startTransition, useState, useTransition } from "react"; | ||
|
||
const QUERY: TypedDocumentNode<{ | ||
products: { | ||
id: string; | ||
title: string; | ||
}[]; | ||
}> = gql` | ||
query dynamicProducts { | ||
products { | ||
id | ||
title | ||
} | ||
} | ||
`; | ||
|
||
export const dynamic = "force-dynamic"; | ||
|
||
export default function Page() { | ||
return ( | ||
<Suspense fallback={"loading"}> | ||
<ErrorBoundary FallbackComponent={FallbackComponent}> | ||
<Component errorLevel={"ssr"} /> | ||
</ErrorBoundary> | ||
</Suspense> | ||
); | ||
} | ||
|
||
function FallbackComponent({ error, resetErrorBoundary }: FallbackProps) { | ||
return ( | ||
<> | ||
<p>{error.message}</p> | ||
</> | ||
); | ||
} | ||
|
||
function Component({ errorLevel }: { errorLevel: "ssr" | "always" }) { | ||
const { data } = useSuspenseQuery(QUERY, { | ||
context: { error: errorLevel }, | ||
}); | ||
globalThis.hydrationFinished?.(); | ||
|
||
return ( | ||
<ul> | ||
{data.products.map(({ id, title }) => ( | ||
<li key={id}>{title}</li> | ||
))} | ||
</ul> | ||
); | ||
} |
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
Oops, something went wrong.