Skip to content

Commit

Permalink
Add todo
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jan 28, 2025
1 parent e70c3fc commit d9fd2e5
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/react/hooks/useFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,18 @@ function useFragment_<TData = any, TVars = OperationVariables>(
});

return {
result: diffToResult({
...diff,
result: client["queryManager"].maskFragment({
fragment,
fragmentName,
// TODO: Revert to `diff.result` once `useFragment` supports `null` as
// valid return value
data: diff.result === null ? {} : diff.result,
}),
} as Cache.DiffResult<TData>),
result: diffToResult(
{
...diff,
result: client["queryManager"].maskFragment({
fragment,
fragmentName,
// TODO: Revert to `diff.result` once `useFragment` supports `null` as
// valid return value
data: diff.result === null ? {} : diff.result,
}),
} as Cache.DiffResult<TData> // TODO: Remove assertion
),
};
}, [client, stableOptions]);

Expand Down Expand Up @@ -166,7 +168,7 @@ function diffToResult<TData>(
const result = {
data: diff.result,
complete: !!diff.complete,
} as UseFragmentResult<TData>;
} as UseFragmentResult<TData>; // TODO: Remove assertion once useFragment returns null

if (diff.missing) {
result.missing = diff.missing.missing;
Expand Down

0 comments on commit d9fd2e5

Please sign in to comment.