Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function useCurrentOperation(props: {
id: operationIdFromSearch!,
},
pause: !operationIdFromSearch,
requestPolicy: 'network-only',
Comment on lines 39 to +42
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the pause option makes the non-null assertion (!) on operationIdFromSearch currently safe, it's better to avoid it as per our coding guidelines to prevent potential bugs. For consistency with useCurrentOperationWithFetchingState in the same file, please provide a fallback value.

Suggested change
id: operationIdFromSearch!,
},
pause: !operationIdFromSearch,
requestPolicy: 'network-only',
id: operationIdFromSearch || '',
},
pause: !operationIdFromSearch,
requestPolicy: 'network-only',
References
  1. Avoid using the non-null assertion operator (!) outside of test files, as it can lead to subtle bugs.

});
// if operationId is undefined `data` could contain previous state
return operationIdFromSearch ? data?.target?.documentCollectionOperation : null;
Expand Down
Loading