Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Feb 2, 2022
1 parent afc1fc3 commit 3a1eadc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-urql/src/hooks/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export const initialState = {
error: undefined,
data: undefined,
extensions: undefined,
operation: undefined
operation: undefined,
};

const isShallowDifferent = (a: any, b: any) => {
if (typeof a != "object" || typeof b != "object") return a !== b;
if (typeof a != 'object' || typeof b != 'object') return a !== b;
for (const x in a) if (!(x in b)) return true;
for (const x in b) if (a[x] !== b[x]) return true;
return false;
Expand All @@ -31,7 +31,7 @@ export const computeNextState = <T extends Stateish>(
data:
result.data !== undefined || result.error ? result.data : prevState.data,
fetching: !!result.fetching,
stale: !!result.stale
stale: !!result.stale,
};

return isShallowDifferent(prevState, newState) ? newState : prevState;
Expand Down

0 comments on commit 3a1eadc

Please sign in to comment.