Skip to content

Commit efcbb96

Browse files
authored
Merge pull request Expensify#68530 from Eskalifer1/fix/67917
Fix/67917 call openReport only once while starting new chat
2 parents 17051f9 + 9e905e5 commit efcbb96

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/pages/NewChatPage.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import useLocalize from '@hooks/useLocalize';
2020
import useNetwork from '@hooks/useNetwork';
2121
import useOnyx from '@hooks/useOnyx';
2222
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
23+
import useSingleExecution from '@hooks/useSingleExecution';
2324
import useThemeStyles from '@hooks/useThemeStyles';
2425
import {navigateToAndOpenReport, searchInServer, setGroupDraft} from '@libs/actions/Report';
2526
import {canUseTouchScreen} from '@libs/DeviceCapabilities';
@@ -173,6 +174,8 @@ function NewChatPage(_: unknown, ref: React.Ref<NewChatPageRef>) {
173174
const [reportAttributesDerived] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {canBeMissing: true, selector: (val) => val?.reports});
174175
const selectionListRef = useRef<SelectionListHandle | null>(null);
175176

177+
const {singleExecution} = useSingleExecution();
178+
176179
useImperativeHandle(ref, () => ({
177180
focus: selectionListRef.current?.focusTextInput,
178181
}));
@@ -292,9 +295,11 @@ function NewChatPage(_: unknown, ref: React.Ref<NewChatPageRef>) {
292295
Log.warn('Tried to create chat with empty login');
293296
return;
294297
}
295-
KeyboardUtils.dismiss().then(() => navigateToAndOpenReport([login]));
298+
KeyboardUtils.dismiss().then(() => {
299+
singleExecution(() => navigateToAndOpenReport([login]))();
300+
});
296301
},
297-
[selectedOptions, toggleOption],
302+
[selectedOptions, toggleOption, singleExecution],
298303
);
299304

300305
const itemRightSideComponent = useCallback(

0 commit comments

Comments
 (0)