This PR improves application performance and stability through targeted optimizations in both frontend and backend:
Frontend
Fix memory leaks in +layout.svelte: The onMount hook was adding event listeners for message, touchstart, touchmove, touchend, and visibilitychange but only cleaning up resize. This causes memory leaks during navigation and hot-reloads. Now all listeners are properly cleaned up.
Add keys to {#each} blocks: Added unique keys to 6 components (ViewSelector, TagSelector, MemberSelector, AccessControl, Tools, Prompts) to enable efficient DOM diffing instead of full re-renders.
Backend
Parallelize image loading: Changed sequential [await load_url_image(img) for img in ...] to asyncio.gather() in image_edits endpoint, significantly reducing latency for multi-image edits.
Unblock async event loop: Wrapped all synchronous requests calls in pipelines.py with asyncio.to_thread() to prevent blocking the FastAPI event loop during external API calls.
Test plan
Verify frontend components render correctly after keyed {#each} changes
Test touch-to-refresh behavior on mobile still works
Test pipeline upload/add/delete operations still function
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/20908
**Author:** [@sjhddh](https://github.com/sjhddh)
**Created:** 1/23/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix/performance-and-memory-leaks`
---
### 📝 Commits (1)
- [`b5261d8`](https://github.com/open-webui/open-webui/commit/b5261d89bb62d72e8f52f968e8449e03071c7b2c) fix: improve performance and fix memory leaks
### 📊 Changes
**9 files changed** (+50 additions, -30 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/routers/images.py` (+2 -1)
📝 `backend/open_webui/routers/pipelines.py` (+25 -14)
📝 `src/lib/components/workspace/Prompts.svelte` (+1 -1)
📝 `src/lib/components/workspace/Tools.svelte` (+1 -1)
📝 `src/lib/components/workspace/common/AccessControl.svelte` (+2 -2)
📝 `src/lib/components/workspace/common/MemberSelector.svelte` (+2 -2)
📝 `src/lib/components/workspace/common/TagSelector.svelte` (+1 -1)
📝 `src/lib/components/workspace/common/ViewSelector.svelte` (+1 -1)
📝 `src/routes/+layout.svelte` (+15 -7)
</details>
### 📄 Description
## Summary
This PR improves application performance and stability through targeted optimizations in both frontend and backend:
### Frontend
- **Fix memory leaks in `+layout.svelte`**: The `onMount` hook was adding event listeners for `message`, `touchstart`, `touchmove`, `touchend`, and `visibilitychange` but only cleaning up `resize`. This causes memory leaks during navigation and hot-reloads. Now all listeners are properly cleaned up.
- **Add keys to `{#each}` blocks**: Added unique keys to 6 components (`ViewSelector`, `TagSelector`, `MemberSelector`, `AccessControl`, `Tools`, `Prompts`) to enable efficient DOM diffing instead of full re-renders.
### Backend
- **Parallelize image loading**: Changed sequential `[await load_url_image(img) for img in ...]` to `asyncio.gather()` in `image_edits` endpoint, significantly reducing latency for multi-image edits.
- **Unblock async event loop**: Wrapped all synchronous `requests` calls in `pipelines.py` with `asyncio.to_thread()` to prevent blocking the FastAPI event loop during external API calls.
## Test plan
- [ ] Verify frontend components render correctly after keyed `{#each}` changes
- [ ] Test touch-to-refresh behavior on mobile still works
- [ ] Test pipeline upload/add/delete operations still function
- [ ] Test image editing with multiple images
---
## Contributor License Agreement
I have read and agree to the [Contributor License Agreement](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT).
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20908
Author: @sjhddh
Created: 1/23/2026
Status: ❌ Closed
Base:
main← Head:fix/performance-and-memory-leaks📝 Commits (1)
b5261d8fix: improve performance and fix memory leaks📊 Changes
9 files changed (+50 additions, -30 deletions)
View changed files
📝
backend/open_webui/routers/images.py(+2 -1)📝
backend/open_webui/routers/pipelines.py(+25 -14)📝
src/lib/components/workspace/Prompts.svelte(+1 -1)📝
src/lib/components/workspace/Tools.svelte(+1 -1)📝
src/lib/components/workspace/common/AccessControl.svelte(+2 -2)📝
src/lib/components/workspace/common/MemberSelector.svelte(+2 -2)📝
src/lib/components/workspace/common/TagSelector.svelte(+1 -1)📝
src/lib/components/workspace/common/ViewSelector.svelte(+1 -1)📝
src/routes/+layout.svelte(+15 -7)📄 Description
Summary
This PR improves application performance and stability through targeted optimizations in both frontend and backend:
Frontend
+layout.svelte: TheonMounthook was adding event listeners formessage,touchstart,touchmove,touchend, andvisibilitychangebut only cleaning upresize. This causes memory leaks during navigation and hot-reloads. Now all listeners are properly cleaned up.{#each}blocks: Added unique keys to 6 components (ViewSelector,TagSelector,MemberSelector,AccessControl,Tools,Prompts) to enable efficient DOM diffing instead of full re-renders.Backend
[await load_url_image(img) for img in ...]toasyncio.gather()inimage_editsendpoint, significantly reducing latency for multi-image edits.requestscalls inpipelines.pywithasyncio.to_thread()to prevent blocking the FastAPI event loop during external API calls.Test plan
{#each}changesContributor License Agreement
I have read and agree to the Contributor License Agreement.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.