Skip to content

Commit

Permalink
Use ternary to handle masking in QueryManager
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Aug 24, 2024
1 parent aa2ed74 commit 23a8080
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1534,24 +1534,16 @@ export class QueryManager<TStore> {

public maskOperation<TData = unknown>(options: MaskOperationOptions<TData>) {
const { document, data } = options;
const { cache } = this;

if (!this.dataMasking) {
return data;
}

return maskOperation(data, document, cache);
return this.dataMasking ? maskOperation(data, document, this.cache) : data;
}

public maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>) {
const { data, fragment, fragmentName } = options;
const { cache } = this;

if (!this.dataMasking) {
return data;
}

return maskFragment(data, fragment, cache, fragmentName);
return this.dataMasking ?
maskFragment(data, fragment, this.cache, fragmentName)
: data;
}

private fetchQueryByPolicy<TData, TVars extends OperationVariables>(
Expand Down

0 comments on commit 23a8080

Please sign in to comment.