Skip to content

Commit

Permalink
flow errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Atkinson committed Jul 31, 2024
1 parent f945299 commit 49699d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions packages/relay-runtime/store/RelayReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1412,17 +1412,18 @@ function getResolverValue(
let resolverResult = null;
let resolverError = null;

const shouldPassContextToLiveResolver =
liveResolverContext && field.kind === 'RelayLiveResolver';
const shouldPassContextToLiveResolver = !!(
liveResolverContext && field.kind === 'RelayLiveResolver'
);
try {
const resolverFunctionArgs = [];
if (field.fragment != null) {
resolverFunctionArgs.push(fragmentKey);
} else {
// Set first argument to `null` in case we have resolver context
// Set first argument to `undefined` in case we have resolver context
// to make sure the context object is always the 3rd argument.
if (shouldPassContextToLiveResolver) {
resolverFunctionArgs.push(null);
resolverFunctionArgs.push(undefined);
}
}
const args = field.args
Expand Down
4 changes: 2 additions & 2 deletions packages/relay-runtime/store/RelayStoreSubscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class RelayStoreSubscriptions implements StoreSubscriptions {
source,
snapshot.selector,
this._resolverCache,
this._liveResolverContext,
this._liveResolverContext || undefined,
);
const nextData = recycleNodesInto(snapshot.data, backup.data);
(backup: $FlowFixMe).data = nextData; // backup owns the snapshot and can safely mutate
Expand Down Expand Up @@ -176,7 +176,7 @@ class RelayStoreSubscriptions implements StoreSubscriptions {
source,
snapshot.selector,
this._resolverCache,
this._liveResolverContext,
this._liveResolverContext || undefined,
)
: backup;
const nextData = recycleNodesInto(snapshot.data, nextSnapshot.data);
Expand Down

0 comments on commit 49699d5

Please sign in to comment.