mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #20913] [MERGED] fix: clean up all event listeners in +layout.svelte onMount #41458
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20913
Author: @sjhddh
Created: 1/23/2026
Status: ✅ Merged
Merged: 1/29/2026
Merged by: @tjbck
Base:
dev← Head:fix/layout-memory-leak📝 Commits (1)
c4a5c45fix: clean up all event listeners in +layout.svelte onMount📊 Changes
1 file changed (+15 additions, -7 deletions)
View changed files
📝
src/routes/+layout.svelte(+15 -7)📄 Description
Summary
Fix memory leaks in
+layout.svelteby properly cleaning up all event listeners added inonMount.Problem
The
onMounthook adds event listeners formessage,touchstart,touchmove,touchend,visibilitychange, andresize, but the cleanup function only removes theresizelistener. The anonymous touch handlers cannot be removed because they have no reference. This causes memory leaks during navigation and hot-reloads.Solution
touchstartHandler,touchmoveHandler,touchendHandler){ passive: false }totouchmovelistener to allowpreventDefault()onMountcleanup function to remove all event listenersFixed
Changed
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.