From f65b0128e7cea3f4440f4f55ded8a3e2290bf7a6 Mon Sep 17 00:00:00 2001 From: B0zal Date: Fri, 25 Aug 2023 12:39:24 +0700 Subject: [PATCH] Issue #2702 should be fixed now kiw kiw where the ChatGPTicon.src glitches and breaks when exporting the image for the second time without refreshing the page. --- app/components/exporter.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx index 2e3cd84a..ba82c285 100644 --- a/app/components/exporter.tsx +++ b/app/components/exporter.tsx @@ -383,7 +383,7 @@ export function PreviewActions(props: { function ExportAvatar(props: { avatar: string }) { if (props.avatar === DEFAULT_MASK_AVATAR) { return ( - ; + return ; } export function ImagePreviewer(props: { @@ -422,6 +422,7 @@ export function ImagePreviewer(props: { ]) .then(() => { showToast(Locale.Copy.Success); + refreshPreview(); }); } catch (e) { console.error("[Copy Image] ", e); @@ -447,11 +448,19 @@ export function ImagePreviewer(props: { link.download = `${props.topic}.png`; link.href = blob; link.click(); + refreshPreview(); } }) .catch((e) => console.log("[Export Image] ", e)); }; + const refreshPreview = () => { + const dom = previewRef.current; + if (dom) { + dom.innerHTML = dom.innerHTML; // Refresh the content of the preview by resetting its HTML for fix a bug glitching + } + }; + return (