Skip to content
Merged
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
10 changes: 8 additions & 2 deletions src/components/PriorityModeController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function PriorityModeController() {
const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID, canBeMissing: true});
const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA, {canBeMissing: true});
const [isInFocusMode, isInFocusModeMetadata] = useOnyx(ONYXKEYS.NVP_PRIORITY_MODE, {selector: (priorityMode) => priorityMode === CONST.PRIORITY_MODE.GSD, canBeMissing: true});
const [hasTriedFocusMode = true, hasTriedFocusModeMetadata] = useOnyx(ONYXKEYS.NVP_TRY_FOCUS_MODE, {canBeMissing: true});
const [hasTriedFocusMode, hasTriedFocusModeMetadata] = useOnyx(ONYXKEYS.NVP_TRY_FOCUS_MODE, {canBeMissing: true});
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
const currentRouteName = useCurrentRouteName();
const [shouldShowModal, setShouldShowModal] = useState(false);
Expand All @@ -50,7 +50,13 @@ export default function PriorityModeController() {
// Listen for state changes and trigger the #focus mode when appropriate
useEffect(() => {
// Wait for Onyx state to fully load
if (isLoadingReportData !== false || !accountID || isLoadingOnyxValue(isInFocusModeMetadata, hasTriedFocusModeMetadata)) {
if (
isLoadingReportData !== false ||
!accountID ||
isLoadingOnyxValue(isInFocusModeMetadata, hasTriedFocusModeMetadata) ||
typeof isInFocusMode !== 'boolean' ||
typeof hasTriedFocusMode !== 'boolean'
) {
return;
}

Expand Down