@quesmed/types 2.6.306 → 2.6.307
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -87,37 +87,28 @@ exports.UPSERT_CONCEPT_NOTE = (0, client_1.gql) `
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
`;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return (cache.identify({
|
|
101
|
-
id: conceptId,
|
|
102
|
-
__typename: 'Concept',
|
|
103
|
-
}) ?? undefined);
|
|
104
|
-
};
|
|
90
|
+
const resolveConceptCacheIds = (cache, conceptId) => Object.entries(cache.extract())
|
|
91
|
+
.filter(([, value]) => value &&
|
|
92
|
+
typeof value === 'object' &&
|
|
93
|
+
'__typename' in value &&
|
|
94
|
+
value.__typename === 'Concept' &&
|
|
95
|
+
// Concept.id is cached as a string; conceptId is an Int
|
|
96
|
+
String(value.id) === String(conceptId))
|
|
97
|
+
.map(([cacheId]) => cacheId);
|
|
105
98
|
const updateCacheOnUpsertConceptNote = (cache, result, options) => {
|
|
106
99
|
const { upsertConceptNote } = result?.data?.restricted || {};
|
|
107
100
|
const { variables } = options || {};
|
|
108
101
|
if (!variables) {
|
|
109
102
|
return;
|
|
110
103
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
userNote: upsertConceptNote,
|
|
120
|
-
},
|
|
104
|
+
resolveConceptCacheIds(cache, variables.conceptId).forEach((cacheId) => {
|
|
105
|
+
cache.writeFragment({
|
|
106
|
+
id: cacheId,
|
|
107
|
+
fragment: fragments_1.UPSERT_CONCEPT_NOTE_FRAGMENT,
|
|
108
|
+
data: {
|
|
109
|
+
userNote: upsertConceptNote,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
121
112
|
});
|
|
122
113
|
};
|
|
123
114
|
exports.updateCacheOnUpsertConceptNote = updateCacheOnUpsertConceptNote;
|
|
@@ -82,37 +82,28 @@ export const UPSERT_CONCEPT_NOTE = gql `
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
`;
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return (cache.identify({
|
|
96
|
-
id: conceptId,
|
|
97
|
-
__typename: 'Concept',
|
|
98
|
-
}) ?? undefined);
|
|
99
|
-
};
|
|
85
|
+
const resolveConceptCacheIds = (cache, conceptId) => Object.entries(cache.extract())
|
|
86
|
+
.filter(([, value]) => value &&
|
|
87
|
+
typeof value === 'object' &&
|
|
88
|
+
'__typename' in value &&
|
|
89
|
+
value.__typename === 'Concept' &&
|
|
90
|
+
// Concept.id is cached as a string; conceptId is an Int
|
|
91
|
+
String(value.id) === String(conceptId))
|
|
92
|
+
.map(([cacheId]) => cacheId);
|
|
100
93
|
export const updateCacheOnUpsertConceptNote = (cache, result, options) => {
|
|
101
94
|
const { upsertConceptNote } = result?.data?.restricted || {};
|
|
102
95
|
const { variables } = options || {};
|
|
103
96
|
if (!variables) {
|
|
104
97
|
return;
|
|
105
98
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
userNote: upsertConceptNote,
|
|
115
|
-
},
|
|
99
|
+
resolveConceptCacheIds(cache, variables.conceptId).forEach((cacheId) => {
|
|
100
|
+
cache.writeFragment({
|
|
101
|
+
id: cacheId,
|
|
102
|
+
fragment: UPSERT_CONCEPT_NOTE_FRAGMENT,
|
|
103
|
+
data: {
|
|
104
|
+
userNote: upsertConceptNote,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
116
107
|
});
|
|
117
108
|
};
|
|
118
109
|
export const optimisticUpsertConceptNote = (data) => {
|