You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intended outcome:
My understanding is that all scalar values (custom or otherwise) should be treated opaquely and replaced when updating. Such updates should not trigger a data loss merge warning.
Actual outcome:
When merging objects containing fields of custom scalar type JSONObject, merge warning are generated in the console for these fields.
How to reproduce the issue:
Include JSONObject custom scalar into your schema and resolver map and use it in a type definition
scalar JSONObject
type Deployment {
id: ID!
state: JSONObject
}
execute a query to fetch an object that uses JSONObject, then update the data in the cache so the merge algorithm runs.
query DeploymentQuery($id: ID) {
deployment(id: $id) {
id
state
}
}
Notice that when a deployment object that has a different value for state is being merged, you see warnings in the console about potential data loss for state field.
While it is possible to write a field merge function that handles updates
for scalar field values, we should treat scalar data as opaque by default,
without displaying "Cache data may be lost..." warnings that nudge the
developer to write an unnecessary merge function.
None: because this code is inside of a process.env.NODE_ENV block, it will
not be executed or bundled in production.
Should fix#7071.
While it is possible to write a field merge function that handles updates
for scalar field values, we should treat scalar data as opaque by default,
without displaying "Cache data may be lost..." warnings that nudge the
developer to write an unnecessary merge function.
None: because this code is inside of a process.env.NODE_ENV block, it will
not be executed or bundled in production.
Should fix#7071.
@vigie This should be fixed in @apollo/client@3.3.0-beta.5 (which includes #7075).
To be clear, this means you shouldn't need to configure JSONObject scalar fields with merge: false to prevent warnings, because there shouldn't be any warnings when updating scalar fields.
Intended outcome:
My understanding is that all scalar values (custom or otherwise) should be treated opaquely and replaced when updating. Such updates should not trigger a data loss merge warning.
Actual outcome:
When merging objects containing fields of custom scalar type JSONObject, merge warning are generated in the console for these fields.
How to reproduce the issue:
Include JSONObject custom scalar into your schema and resolver map and use it in a type definition
execute a query to fetch an object that uses JSONObject, then update the data in the cache so the merge algorithm runs.
Notice that when a deployment object that has a different value for state is being merged, you see warnings in the console about potential data loss for
state
field.Versions
The text was updated successfully, but these errors were encountered: