From fe93aea224be1fb9fe3d3fef1936f9244a1d489d Mon Sep 17 00:00:00 2001 From: OtavioStasiak Date: Tue, 12 Nov 2024 12:26:56 -0300 Subject: [PATCH] fix: added await on checkCache --- app/containers/message/hooks/useMediaAutoDownload.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/containers/message/hooks/useMediaAutoDownload.tsx b/app/containers/message/hooks/useMediaAutoDownload.tsx index a884a6941b..f5ddebfe53 100644 --- a/app/containers/message/hooks/useMediaAutoDownload.tsx +++ b/app/containers/message/hooks/useMediaAutoDownload.tsx @@ -136,10 +136,10 @@ export const useMediaAutoDownload = ({ urlToCache: url }); if (result?.exists && !isEncrypted) { - if(!currentFile?.title_link) { - persistMessageWithCacheFile(id, result.uri, file.encryption, file.image_url || url); + if (!currentFile?.title_link) { + await persistMessageWithCacheFile(id, result.uri, file.encryption, file.image_url || url); } - + updateCurrentFile(result.uri); } return result?.exists;