Compare commits

...
Author SHA1 Message Date
Sonarly Claude CodeandClaude Opus 4.6 6b16ebcd77 Fix SSE error when cached query filter references removed fields
When custom fields (like ownerId) are removed from an object's metadata,
cached Apollo queries may still have filters referencing those fields.
During SSE-triggered optimistic cache updates, isRecordMatchingFilter
throws because the filter key no longer maps to any field metadata.

Add try-catch around isRecordMatchingFilter in the create records
optimistic effect so that records with stale filters are gracefully
skipped instead of crashing the SSE message handler.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-19 00:45:02 +00:00
@@ -136,14 +136,18 @@ export const triggerCreateRecordsOptimisticEffect = ({
isDefined(rootQueryFilter) &&
shouldMatchRootQueryFilter === true
) {
const recordToCreateMatchesThisRootQueryFilter =
isRecordMatchingFilter({
record: recordToCreate,
filter: rootQueryFilter,
objectMetadataItem,
});
try {
const recordToCreateMatchesThisRootQueryFilter =
isRecordMatchingFilter({
record: recordToCreate,
filter: rootQueryFilter,
objectMetadataItem,
});
if (!recordToCreateMatchesThisRootQueryFilter) {
if (!recordToCreateMatchesThisRootQueryFilter) {
return false;
}
} catch {
return false;
}
}