Skip to content

Commit ff4ca55

Browse files
committed
Enable fragments for prerendering
1 parent 1671888 commit ff4ca55

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/web/src/components/cell/createCell.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { fragmentRegistry } from '../../apollo'
12
import { getOperationName } from '../../graphql'
23
/**
34
* This is part of how we let users swap out their GraphQL client while staying compatible with Cells.
@@ -68,6 +69,8 @@ function createNonSuspendingCell<
6869
const { queryCache } = useCellCacheContext()
6970
const operationName = getOperationName(query)
7071

72+
const transformedQuery = fragmentRegistry.transform(query)
73+
7174
let cacheKey
7275

7376
if (operationName) {
@@ -99,7 +102,7 @@ function createNonSuspendingCell<
99102
} else {
100103
queryCache[cacheKey] ||
101104
(queryCache[cacheKey] = {
102-
query,
105+
query: transformedQuery,
103106
variables: options.variables,
104107
hasProcessed: false,
105108
})

0 commit comments

Comments
 (0)