Skip to content

Commit

Permalink
Merge pull request #42406 from burczu/bugfix/41188-new-messages-butto…
Browse files Browse the repository at this point in the history
…n-does-not-disappear

Bugfix/41188 new messages button does not disappear
  • Loading branch information
mountiny authored May 27, 2024
2 parents 3599850 + 6dfb6fd commit 2514f29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,13 @@ function ReportActionsList({
),
[sortedReportActions, isOffline],
);

// whisper action doesn't affect lastVisibleActionCreated, so we should not take it into account while checking if there is the newest report action
const newestVisibleReportAction = useMemo(() => sortedVisibleReportActions.find((item) => !ReportActionsUtils.isWhisperAction(item)) ?? null, [sortedVisibleReportActions]);

const lastActionIndex = sortedVisibleReportActions[0]?.reportActionID;
const reportActionSize = useRef(sortedVisibleReportActions.length);
const hasNewestReportAction = sortedVisibleReportActions?.[0]?.created === report.lastVisibleActionCreated;
const hasNewestReportAction = newestVisibleReportAction?.created === report.lastVisibleActionCreated;
const hasNewestReportActionRef = useRef(hasNewestReportAction);
hasNewestReportActionRef.current = hasNewestReportAction;
const previousLastIndex = useRef(lastActionIndex);
Expand Down

0 comments on commit 2514f29

Please sign in to comment.