diff --git a/src/react/hooks/__tests__/useInteractiveQuery.test.tsx b/src/react/hooks/__tests__/useInteractiveQuery.test.tsx index 14ac640ded4..04dbb027571 100644 --- a/src/react/hooks/__tests__/useInteractiveQuery.test.tsx +++ b/src/react/hooks/__tests__/useInteractiveQuery.test.tsx @@ -2025,7 +2025,7 @@ it("applies `context` on next fetch when it changes between renders", async () = const user = userEvent.setup(); - const query: TypedDocumentNode = gql` + const query: TypedDocumentNode = gql` query { context } @@ -2050,7 +2050,7 @@ it("applies `context` on next fetch when it changes between renders", async () = function Parent() { const [phase, setPhase] = React.useState("initial"); - const [queryRef, { refetch }] = useInteractiveQuery(query, { + const [queryRef, loadQuery, { refetch }] = useInteractiveQuery(query, { context: { phase }, }); @@ -2058,8 +2058,9 @@ it("applies `context` on next fetch when it changes between renders", async () = <> + }> - + {queryRef && } ); @@ -2081,6 +2082,8 @@ it("applies `context` on next fetch when it changes between renders", async () = render(); + await act(() => user.click(screen.getByText("Load query"))); + expect(await screen.findByTestId("context")).toHaveTextContent("initial"); await act(() => user.click(screen.getByText("Update context")));