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: 0 additions & 12 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import type {
BankAccountList,
Beta,
IntroSelected,
NewGroupChatDraft,

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.

add to k2s

OnyxInputOrEntry,
OutstandingReportsByPolicyIDDerivedValue,
PersonalDetails,
Expand Down Expand Up @@ -1223,12 +1222,6 @@ Onyx.connectWithoutView({
},
});

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

let cachedSelfDMReportID: OnyxEntry<string>;
Onyx.connectWithoutView({
key: ONYXKEYS.SELF_DM_REPORT_ID,
Expand Down Expand Up @@ -12580,10 +12573,6 @@ function isWaitingForSubmissionFromCurrentUser(chatReport: OnyxEntry<Report>, po
return chatReport?.isOwnPolicyExpenseChat && !policy?.harvesting?.enabled;
}

function getGroupChatDraft() {
return newGroupChatDraft;
}

function getChatListItemReportName(action: ReportAction & {reportName?: string}, report: Report | undefined): string {
if (report && isInvoiceReport(report)) {
const properInvoiceReport = report;
Expand Down Expand Up @@ -13374,7 +13363,6 @@ export {
buildOptimisticResolvedDuplicatesReportAction,
getTitleReportField,
getReportFieldsByPolicyID,
getGroupChatDraft,
getChatListItemReportName,
buildOptimisticMovedTransactionAction,
populateOptimisticReportFormula,
Expand Down
8 changes: 6 additions & 2 deletions src/pages/GroupChatNameEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ 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/ReportNameUtils';
import {getGroupChatDraft} from '@libs/ReportUtils';
import StringUtils from '@libs/StringUtils';
import {setGroupDraft, updateChatName} from '@userActions/Report';
import CONST from '@src/CONST';
Expand All @@ -23,6 +22,7 @@ import type SCREENS from '@src/SCREENS';
import INPUT_IDS from '@src/types/form/NewChatNameForm';
import type {Report as ReportOnyxType} from '@src/types/onyx';
import type {Errors} from '@src/types/onyx/OnyxCommon';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

type GroupChatNameEditPageProps = Partial<PlatformStackScreenProps<NewChatNavigatorParamList, typeof SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME>> & {
report?: ReportOnyxType;
Expand All @@ -33,7 +33,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 = getGroupChatDraft()] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, {canBeMissing: true});
const [groupChatDraft, groupChatDraftMetadata] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, {canBeMissing: true});

const styles = useThemeStyles();
const {translate, formatPhoneNumber} = useLocalize();
Expand Down Expand Up @@ -68,6 +68,10 @@ function GroupChatNameEditPage({report}: GroupChatNameEditPageProps) {
Navigation.setNavigationActionToMicrotaskQueue(() => Navigation.goBack(ROUTES.NEW_CHAT_CONFIRM));
};

if (isLoadingOnyxValue(groupChatDraftMetadata)) {
return null;
}

return (
<ScreenWrapper
includeSafeAreaPaddingBottom
Expand Down
Loading