Skip to content

Commit aaecf4c

Browse files
MelvinBotPujan92
andcommitted
Switch to useEffect approach for unread marker fix
Revert the skeleton guard change and instead fix the useEffect in ReportActionsList to also fire when reportLastReadTime transitions from empty to populated, so the marker initializes correctly after sign-in without showing an extra skeleton flash. Co-authored-by: Pujan Shah <Pujan92@users.noreply.github.com>
1 parent a05c59a commit aaecf4c

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/pages/inbox/report/ReportActionsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function ReportActionsList({
262262
setUnreadMarkerTime(reportLastReadTime);
263263

264264
// eslint-disable-next-line react-hooks/exhaustive-deps
265-
}, [report.reportID]);
265+
}, [report.reportID, reportLastReadTime === '' ? 'empty' : 'populated']);
266266

267267
const prevUnreadMarkerReportActionID = useRef<string | null>(null);
268268

src/pages/inbox/report/ReportActionsView.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ function ReportActionsView({reportID, onLayout}: ReportActionsViewProps) {
368368
const shouldShowSkeletonForInitialLoad = isLoadingInitialReportActions && (isReportDataIncomplete || isMissingReportActions) && !isOffline;
369369

370370
// Show skeleton while the app is loading and we're online
371-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
372-
const shouldShowSkeletonForAppLoad = (isLoadingApp || (isLoadingInitialReportActions && !hasOnceLoadedReportActions)) && !isOffline;
371+
const shouldShowSkeletonForAppLoad = isLoadingApp && !isOffline;
373372

374373
// Show skeleton for the Concierge side panel until report data has been
375374
// loaded at least once. Before the first openReport response, hasOlderActions

0 commit comments

Comments
 (0)