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
17 changes: 17 additions & 0 deletions src/pages/home/report/UserTypingEventListener.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ function UserTypingEventListener({report, lastVisitedPath}: UserTypingEventListe
const reportID = report.reportID;
const isFocused = useIsFocused();
const route = useRoute<RouteProp<CentralPaneNavigatorParamList, typeof SCREENS.REPORT>>();

useEffect(
() => () => {
if (!didSubscribeToReportTypingEvents.current) {
return;
}

// unsubscribe from report typing events when the component unmounts
didSubscribeToReportTypingEvents.current = false;
InteractionManager.runAfterInteractions(() => {
Report.unsubscribeFromReportChannel(reportID);
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[],
);

useEffect(() => {
// Ensures any optimistic report that is being created (ex: a thread report) gets created and initialized successfully before subscribing
if (route?.params?.reportID !== reportID) {
Expand Down