# apollo-client/release
Apollo Client @apollo/client@4.3.0
importance: highbreakingmigrationfeature
This release introduces changes to how field policies and `inputObjects` handle arrays of scalars, requiring updates to configurations. It also improves the accuracy of `dataState` in streaming scenarios and adds a helper for creating `Scalar` instances from `GraphQLScalarType`.
affected
Developers using field policies and `inputObjects` with arrays of scalars or scalar values that are arrays are affected by the breaking changes.
action
Review and update field policies and `inputObjects` configurations to use the new GraphQL list syntax for scalar lists.
release_signals
-The field policy `scalar` option and `inputObjects` type string now use GraphQL list syntax to mark a field as a list of scalars.
-The abstract `cache.getScalarForField` is now `cache.getScalarTypeForField` and is expected to return the string representing the scalar type rather than the `Scalar` instance.
+Field policies and `inputObjects` can now distinguish between a list of scalars and a scalar whose value is an array.
+Added `Scalar.fromGraphQLScalarType` helper to create a `Scalar` instance from an existing `GraphQLScalarType`.
+Improved accuracy of `dataState` in complex incremental streaming scenarios, especially with `returnPartialData: true`.
migration_steps2 steps
- 01Update field policy `scalar` options and `inputObjects` type strings to use GraphQL list syntax for lists of scalars.
- 02Replace `cache.getScalarForField` with `cache.getScalarTypeForField` and ensure it returns the scalar type string.
code_snippet
const dateTimeRangeScalar = new Scalar<
[string, string],
{ start: Date; end: Date }
>({
parse: ([start, end]) => ({
start: new Date(start),
end: new Date(end),
}),
serialize: (range) => [range.start.toISOString(), range.end.toISOString()],
is: (value) => !Array.isArray(value),
});# community_signal
How useful is this release to your stack?
—
net score
Sign in with GitHub to cast your vote.
Sign in with GitHub to vote
You’ll return to this release, then choose your vote.