Skip to content

Commit

Permalink
Merge pull request #43542 from dominictb/fix/43089
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham authored Jun 23, 2024
2 parents 4dc1710 + ae03a7f commit 5fb3cb6
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit 5fb3cb6

Please sign in to comment.