From 42e004ce206afd98f4cba5c04d28f14fd630a2fa Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 18 Dec 2022 22:14:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96withKeepAliveOverlay?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0=E4=BE=9D=E8=B5=96=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=B8=8D=E5=BC=BA=E5=88=B6=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E6=97=B6=E6=97=A0=E6=B3=95=E5=8F=96=E6=B6=88=E6=8C=82?= =?UTF-8?q?=E8=BD=BD=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KeepAliveOverlay/withKeepAliveOverlay.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/web/src/components/KeepAliveOverlay/withKeepAliveOverlay.tsx b/client/web/src/components/KeepAliveOverlay/withKeepAliveOverlay.tsx index 27c341e5..d1e7fe5b 100644 --- a/client/web/src/components/KeepAliveOverlay/withKeepAliveOverlay.tsx +++ b/client/web/src/components/KeepAliveOverlay/withKeepAliveOverlay.tsx @@ -19,7 +19,9 @@ export function withKeepAliveOverlay< OP extends Omit = Omit >( OriginComponent: React.ComponentType, - config: { cacheId: string | ((props: OP) => string) } + config: { + cacheId: string | ((props: OP) => string); + } ) { // eslint-disable-next-line react/display-name return (props: P) => { @@ -32,7 +34,7 @@ export function withKeepAliveOverlay< } return config.cacheId; - }, []); + }, [originProps]); useEffect(() => { mount(cacheId, ); @@ -40,7 +42,7 @@ export function withKeepAliveOverlay< return () => { hide(cacheId); }; - }, []); + }, [cacheId]); useEffect(() => { if (!containerRef.current) { @@ -72,7 +74,7 @@ export function withKeepAliveOverlay< resizeObserver.unobserve(containerRef.current); } }; - }, []); + }, [cacheId]); return (