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
9 changes: 5 additions & 4 deletions src/pages/NewChatConfirmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Participant} from '@src/types/onyx/IOU';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

function navigateBack() {
Navigation.goBack(ROUTES.NEW_CHAT);
Expand All @@ -38,7 +39,7 @@ function NewChatConfirmPage() {
const {translate} = useLocalize();
const styles = useThemeStyles();
const personalData = useCurrentUserPersonalDetails();
const [newGroupDraft] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT);
const [newGroupDraft, newGroupDraftMetaData] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT);
const [allPersonalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);

const selectedOptions = useMemo((): Participant[] => {
Expand Down Expand Up @@ -101,7 +102,7 @@ function NewChatConfirmPage() {
const stashedLocalAvatarImage = newGroupDraft?.avatarUri;

useEffect(() => {
if (!stashedLocalAvatarImage) {
if (!stashedLocalAvatarImage || isLoadingOnyxValue(newGroupDraftMetaData)) {
return;
}

Expand All @@ -118,9 +119,9 @@ function NewChatConfirmPage() {
// To handle this, we re-read the avatar image file from disk whenever the component re-mounts.
readFileAsync(stashedLocalAvatarImage, newGroupDraft?.avatarFileName ?? '', onSuccess, onFailure, newGroupDraft?.avatarFileType ?? '');

// we only need to run this when the component re-mounted
// we only need to run this when the component re-mounted and when the onyx is loaded completely

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change:

// we only need to run this when the component re-mounted and when onyx is loaded completely

// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []);
}, [newGroupDraftMetaData]);

return (
<ScreenWrapper testID={NewChatConfirmPage.displayName}>
Expand Down