@quesmed/types 2.6.232 → 2.6.233

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.
@@ -209,7 +209,24 @@ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus, entitleme
209
209
  return;
210
210
  }
211
211
  const { conceptIds, status } = variables;
212
+ const entitlementIdentity = {
213
+ __ref: cache.identify({
214
+ id: entitlement,
215
+ __typename: 'Entitlement',
216
+ }),
217
+ };
212
218
  conceptIds.forEach((id) => {
219
+ if (entitlement) {
220
+ cache.writeFragment({
221
+ id: cache.identify({
222
+ id: id.toString,
223
+ entitlement: entitlementIdentity,
224
+ __typename: 'Concept',
225
+ }),
226
+ data: { status },
227
+ fragment: STATUS_CONCEPT_FRAGMENT,
228
+ });
229
+ }
213
230
  cache.writeFragment({
214
231
  id: cache.identify({ id, __typename: 'Concept' }),
215
232
  data: { status },
@@ -219,12 +236,7 @@ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus, entitleme
219
236
  const topicFragmentId = cache.identify({
220
237
  id: topicId.toString(),
221
238
  ...(entitlement && {
222
- entitlement: {
223
- __ref: cache.identify({
224
- id: entitlement,
225
- __typename: 'Entitlement',
226
- }),
227
- },
239
+ entitlement: entitlementIdentity,
228
240
  }),
229
241
  __typename: 'Topic',
230
242
  });
@@ -203,7 +203,24 @@ export const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus, en
203
203
  return;
204
204
  }
205
205
  const { conceptIds, status } = variables;
206
+ const entitlementIdentity = {
207
+ __ref: cache.identify({
208
+ id: entitlement,
209
+ __typename: 'Entitlement',
210
+ }),
211
+ };
206
212
  conceptIds.forEach((id) => {
213
+ if (entitlement) {
214
+ cache.writeFragment({
215
+ id: cache.identify({
216
+ id: id.toString,
217
+ entitlement: entitlementIdentity,
218
+ __typename: 'Concept',
219
+ }),
220
+ data: { status },
221
+ fragment: STATUS_CONCEPT_FRAGMENT,
222
+ });
223
+ }
207
224
  cache.writeFragment({
208
225
  id: cache.identify({ id, __typename: 'Concept' }),
209
226
  data: { status },
@@ -213,12 +230,7 @@ export const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus, en
213
230
  const topicFragmentId = cache.identify({
214
231
  id: topicId.toString(),
215
232
  ...(entitlement && {
216
- entitlement: {
217
- __ref: cache.identify({
218
- id: entitlement,
219
- __typename: 'Entitlement',
220
- }),
221
- },
233
+ entitlement: entitlementIdentity,
222
234
  }),
223
235
  __typename: 'Topic',
224
236
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.232",
3
+ "version": "2.6.233",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",