Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: debounce ref (#26433)

crazywoolafd86cadf679b
diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsx
index bee37cf2cd3..a362f4dc996 100644
--- a/web/app/components/base/chat/chat/index.tsx
+++ b/web/app/components/base/chat/chat/index.tsx
@@ -160,8 +160,13 @@ const Chat: FC<ChatProps> = ({
})
useEffect(() => {
- window.addEventListener('resize', debounce(handleWindowResize))
- return () => window.removeEventListener('resize', handleWindowResize)
+ const debouncedHandler = debounce(handleWindowResize, 200)
+ window.addEventListener('resize', debouncedHandler)
+
+ return () => {
+ window.removeEventListener('resize', debouncedHandler)
+ debouncedHandler.cancel()
+ }
}, [handleWindowResize])
useEffect(() => {