Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import type {
Beta,
NewGroupChatDraft,
OnyxInputOrEntry,
PersonalDetails,
PersonalDetailsList,
Expand Down Expand Up @@ -1000,6 +1001,12 @@ Onyx.connect({
callback: (value) => (activePolicyID = value),
});

let newGroupChatDraft: OnyxEntry<NewGroupChatDraft>;
Onyx.connect({
key: ONYXKEYS.NEW_GROUP_CHAT_DRAFT,
callback: (value) => (newGroupChatDraft = value),
});

function getCurrentUserAvatar(): AvatarSource | undefined {
return currentUserPersonalDetails?.avatar;
}
Expand Down Expand Up @@ -9472,6 +9479,10 @@ function isTestTransactionReport(report: OnyxEntry<Report>): boolean {
return isSelectedManagerMcTest(persionalDetails?.login);
}

function getGroupChatDraft() {
return newGroupChatDraft;
}

export {
addDomainToShortMention,
completeShortMention,
Expand Down Expand Up @@ -9824,6 +9835,7 @@ export {
populateOptimisticReportFormula,
getTitleReportField,
getReportFieldsByPolicyID,
getGroupChatDraft,
};

export type {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/GroupChatNameEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import type {NewChatNavigatorParamList} from '@libs/Navigation/types';
import {getGroupChatName} from '@libs/ReportUtils';
import {getGroupChatDraft, getGroupChatName} from '@libs/ReportUtils';
import {setGroupDraft, updateChatName} from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -31,7 +31,7 @@ function GroupChatNameEditPage({report}: GroupChatNameEditPageProps) {
// In this case its better to use empty string as the reportID if there is no reportID
const reportID = report?.reportID;
const isUpdatingExistingReport = !!reportID;
const [groupChatDraft] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT);
const [groupChatDraft] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, {initialValue: getGroupChatDraft()});

const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down