diff --git a/e2e/react/src/components/SponsorInfo.tsx b/e2e/react/src/components/SponsorInfo.tsx
new file mode 100644
index 000000000..0dc05b726
--- /dev/null
+++ b/e2e/react/src/components/SponsorInfo.tsx
@@ -0,0 +1,19 @@
+import { graphql, useFragment, type SponsorInfo } from '$houdini'
+
+type Props = {
+ sponsor: SponsorInfo
+}
+
+export default function SponsorSummary(props: Props) {
+ const data = useFragment(
+ props.sponsor,
+ graphql(`
+ fragment SponsorInfo on Sponsor {
+ name
+ avatarUrl
+ }
+ `)
+ )
+
+ return
{data?.name}
+}
diff --git a/e2e/react/src/routes/+page.gql b/e2e/react/src/routes/+page.gql
index 957a410d7..e5514261c 100644
--- a/e2e/react/src/routes/+page.gql
+++ b/e2e/react/src/routes/+page.gql
@@ -1,5 +1,6 @@
query SponsorList {
sponsors {
name
+ ...SponsorInfo
}
}
diff --git a/e2e/react/src/routes/+page.tsx b/e2e/react/src/routes/+page.tsx
index 1ea24975b..b29675a30 100644
--- a/e2e/react/src/routes/+page.tsx
+++ b/e2e/react/src/routes/+page.tsx
@@ -1,5 +1,21 @@
+import { cache } from '$houdini/runtime'
+import SponsorInfo from '~/components/SponsorInfo'
+
import type { PageProps } from './$types'
+if (globalThis.window) {
+ // @ts-ignore
+ window.cache = cache
+}
+
export default function ({ SponsorList }: PageProps) {
- return {JSON.stringify(SponsorList)}
+ return (
+
+ {SponsorList.sponsors.map((sponsor) => (
+
+
+
+ ))}
+
+ )
}
diff --git a/packages/houdini-react/src/runtime/hooks/useFragment.ts b/packages/houdini-react/src/runtime/hooks/useFragment.ts
index b7355c1e5..465db756d 100644
--- a/packages/houdini-react/src/runtime/hooks/useFragment.ts
+++ b/packages/houdini-react/src/runtime/hooks/useFragment.ts
@@ -1,9 +1,9 @@
-import cache from '$houdini/runtime/cache'
import { deepEquals } from '$houdini/runtime/lib/deepEquals'
import { fragmentKey } from '$houdini/runtime/lib/types'
import type { GraphQLObject, GraphQLVariables, FragmentArtifact } from '$houdini/runtime/lib/types'
import * as React from 'react'
+import { useRouterContext } from '../routing'
import { useDeepCompareMemoize } from './useDeepCompareEffect'
import { useDocumentSubscription } from './useDocumentSubscription'
@@ -15,6 +15,8 @@ export function useFragment<
reference: _Data | { [fragmentKey]: _ReferenceType } | null,
document: { artifact: FragmentArtifact }
) {
+ const { cache } = useRouterContext()
+
// get the fragment reference info
const { parent, variables, loading } = fragmentReference<_Data, _Input, _ReferenceType>(
reference,
@@ -46,10 +48,7 @@ export function useFragment<
stuff: {
parentID: parent,
},
- // setup = true?
- // we don't need to do the first read because we
- // have an initial value...
- // does Boolean(initialValue) === { setup: true }
+ setup: true,
},
})
diff --git a/turbo.json b/turbo.json
index fa6e24fa3..c23fe6575 100644
--- a/turbo.json
+++ b/turbo.json
@@ -5,7 +5,7 @@
"dependsOn": ["^compile"]
},
"typedefs": {
- "dependsOn": ["^typedefs"]
+ "dependsOn": ["^typedefs", "^compile"]
},
"build": {
"dependsOn": ["typedefs", "compile"]