From ca73a7cf0e4347869f7de032317f5d85fbda7ed1 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 5 Sep 2024 23:28:03 +0300 Subject: [PATCH] set original file name optimistically --- src/libs/actions/Policy/Policy.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 018089ed62f0..da0913ead5e6 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -991,6 +991,7 @@ function updateWorkspaceAvatar(policyID: string, file: File) { * Deletes the avatar image for the workspace */ function deleteWorkspaceAvatar(policyID: string) { + const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ { onyxMethod: Onyx.METHOD.MERGE, @@ -1003,6 +1004,7 @@ function deleteWorkspaceAvatar(policyID: string) { avatarURL: null, }, avatarURL: '', + originalFileName: null, }, }, ]; @@ -1022,6 +1024,8 @@ function deleteWorkspaceAvatar(policyID: string) { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, value: { + avatarURL: policy?.avatarURL, + originalFileName: policy?.originalFileName, errorFields: { avatarURL: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('avatarWithImagePicker.deleteWorkspaceError'), },