Skip to content

Commit

Permalink
Move updateContext in write.ts' updater call
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Feb 3, 2021
1 parent 352c83a commit 9c15fd4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions exchanges/graphcache/src/operations/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,20 +299,20 @@ const writeSelection = (
}

if (isRoot) {
// We have to update the context to reflect up-to-date ResolveInfo
updateContext(
ctx,
data,
typename,
typename,
joinKeys(typename, fieldKey),
fieldName
);

// We run side-effect updates after the default, normalized updates
// so that the data is already available in-store if necessary
const updater = ctx.store.updates[typename][fieldName];
if (updater) {
// We have to update the context to reflect up-to-date ResolveInfo
updateContext(
ctx,
data,
typename,
typename,
joinKeys(typename, fieldKey),
fieldName
);

data[fieldName] = fieldValue;
updater(data, fieldArgs || {}, ctx.store, ctx);
}
Expand Down

0 comments on commit 9c15fd4

Please sign in to comment.