From 15533d3d8a1b7a18dee1ba0f88f09058e365b2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Rusakow?= Date: Thu, 29 Dec 2022 22:19:23 +0100 Subject: [PATCH] wrap promise response in set timeout to keep local state in sync (#2531) --- web/components/config/EditLogo.tsx | 3 +-- web/utils/images.ts | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/web/components/config/EditLogo.tsx b/web/components/config/EditLogo.tsx index e51007964..c566b6433 100644 --- a/web/components/config/EditLogo.tsx +++ b/web/components/config/EditLogo.tsx @@ -71,7 +71,7 @@ export const EditLogo: FC = () => { getBase64(file, (url: string) => { setlogoUrl(url); - return res(); + setTimeout(() => res(), 100); }); }); }; @@ -80,7 +80,6 @@ export const EditLogo: FC = () => { const handleLogoUpdate = async () => { if (logoUrl !== currentLogo) { setSubmitStatus(createInputStatus(STATUS_PROCESSING)); - await postConfigUpdateToAPI({ apiPath, data: { value: logoUrl }, diff --git a/web/utils/images.ts b/web/utils/images.ts index 97ea19fcb..06dfd920e 100644 --- a/web/utils/images.ts +++ b/web/utils/images.ts @@ -1,5 +1,3 @@ -import { RcFile } from 'antd/lib/upload'; - export const MAX_IMAGE_FILESIZE = 2097152; export const ACCEPTED_IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/gif'];