Skip to content

@defer gives TypeError: Cannot read properties of undefined (reading 'length') #12245

@VinceBT-BG

Description

@VinceBT-BG

This is an example of query:

query listAuthorsWithStats(
	$authorIds: [ID!]
	$startDate: DateTime!
	$endDate: DateTime!
	$timeZone: String!
) {
	listAuthors(
		authorIds: $authorIds
		startDate: $startDate
		endDate: $endDate
	) {
		authors {
			id
			... @defer {
				stats(startDate: $startDate, endDate: $endDate, timeZone: $timeZone) {
					aggregates {
						labels
						value
					}
				}
			}
		}
	}
}

And this is the stacktrace of the error that I get:

[Network]: TypeError: Cannot read properties of undefined (reading 'length')
0:" at eval (webpack-internal:///../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]_bwcf472rfi3np7dy47bczsyb6q/node_modules/@apollo/client/utilities/common/incrementalResult.js:38:31)"
1:" at Array.forEach (<anonymous>)"
2:" at mergeIncrementalData (webpack-internal:///../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]_bwcf472rfi3np7dy47bczsyb6q/node_modules/@apollo/client/utilities/common/incrementalResult.js:36:28)"
3:" at QueryInfo.markResult (webpack-internal:///../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]_bwcf472rfi3np7dy47bczsyb6q/node_modules/@apollo/client/core/QueryInfo.js:274:103)"
4:" at eval (webpack-internal:///../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]_bwcf472rfi3np7dy47bczsyb6q/node_modules/@apollo/client/core/QueryManager.js:812:27)"
5:" at both (webpack-internal:///../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]_bwcf472rfi3np7dy47bczsyb6q/node_modules/@apollo/client/utilities/observables/asyncMap.js:27:31)"

I have been following the tutorial from here

These are the versions that I use:

"@apollo/client": "^3.12.4"
"graphql": "^17.0.0-alpha.7"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions