-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor shouldFetchReport function to reduce updates
- Loading branch information
1 parent
d46c4cc
commit 2a3c29e
Showing
3 changed files
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import type {OnyxEntry} from 'react-native-onyx'; | ||
import type Report from '@src/types/onyx/Report'; | ||
import type ReportMetadata from '@src/types/onyx/ReportMetadata'; | ||
|
||
export default function shouldFetchReport(report: OnyxEntry<Report>, reportMetadata: OnyxEntry<ReportMetadata>) { | ||
export default function shouldFetchReport(report: OnyxEntry<Report>, isOptimisticReport?: boolean) { | ||
// If the report is optimistic, there's no need to fetch it. The original action should create it. | ||
// If there is an error for creating the chat, there's no need to fetch it since it doesn't exist | ||
return !reportMetadata?.isOptimisticReport && !report?.errorFields?.createChat; | ||
return !isOptimisticReport && !report?.errorFields?.createChat; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters