Skip to content

Commit 9f5a0fd

Browse files
committed
Cleanup spans in SearchMoneyRequestReportPage
1 parent b598864 commit 9f5a0fd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/pages/Search/SearchMoneyRequestReportPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
isMoneyRequestAction,
3434
} from '@libs/ReportActionsUtils';
3535
import {isValidReportIDFromPath} from '@libs/ReportUtils';
36+
import {cancelSpansByPrefix} from '@libs/telemetry/activeSpans';
3637
import {isDefaultAvatar, isLetterAvatar, isPresetAvatar} from '@libs/UserAvatarUtils';
3738
import Navigation from '@navigation/Navigation';
3839
import ReactionListWrapper from '@pages/inbox/ReactionListWrapper';
@@ -194,6 +195,11 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) {
194195

195196
useEffect(() => {
196197
hasCreatedLegacyThreadRef.current = false;
198+
199+
return () => {
200+
// Cancel any pending send-message spans to prevent orphaned spans when navigating away
201+
cancelSpansByPrefix(CONST.TELEMETRY.SPAN_SEND_MESSAGE);
202+
};
197203
}, [reportIDFromRoute]);
198204

199205
// Create transaction thread for legacy transactions that don't have one yet.

0 commit comments

Comments
 (0)