Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Feb 10, 2025
1 parent 426e221 commit c265fed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/hooks/useNetworkWithOfflineStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ export default function useNetworkWithOfflineStatus(): UseNetworkWithOfflineStat
const lastOnlineAt = useRef(isOffline ? undefined : DateUtils.getLocalDateFromDatetime(preferredLocale));

useEffect(() => {
// If the user has just gone offline (was online before but is now offline), update `lastOfflineAt` with the current local date/time.
if (isOffline && !prevIsOffline) {
lastOfflineAt.current = DateUtils.getLocalDateFromDatetime(preferredLocale);
}

// If the user has just come back online (was offline before but is now online), update `lastOnlineAt` with the current local date/time.
if (!isOffline && prevIsOffline) {
lastOnlineAt.current = DateUtils.getLocalDateFromDatetime(preferredLocale);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@ function getReportActionsLength() {
}

function wasActionCreatedWhileOffline(action: ReportAction, isOffline: boolean, lastOfflineAt: Date | undefined, lastOnlineAt: Date | undefined, locale: Locale): boolean {
// The user never was never offline.
// The user has never gone offline or never come back online
if (!lastOfflineAt || !lastOnlineAt) {
return false;
}
Expand Down

0 comments on commit c265fed

Please sign in to comment.