mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-10 23:55:15 -05:00
[PR #21880] [MERGED] perf: cache KaTeX module import as singleton across all renderer instances #65173
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/21880
Author: @Classic298
Created: 2/25/2026
Status: ✅ Merged
Merged: 2/26/2026
Merged by: @tjbck
Base:
dev← Head:perf/katex-singleton-import📝 Commits (2)
f7866d3perf: cache KaTeX module import as singleton across all renderer instances1550cc7Update KatexRenderer.svelte📊 Changes
1 file changed (+19 additions, -7 deletions)
View changed files
📝
src/lib/components/chat/Messages/Markdown/KatexRenderer.svelte(+19 -7)📄 Description
KatexRenderer.svelte dynamically imports katex, mhchem, and the CSS on every component mount. When a message contains multiple math expressions, this triggers redundant module resolution for each one. Move the import promise to a module-level singleton using Svelte's context='module' script block so it loads once and is shared across all KatexRenderer instances.
this is a completely invisible change - free lunch
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.