mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-03 18:17:56 -05:00
Scrolling inside a PDF shown inline in a chat froze the whole page for seconds at a time, on phones and on desktop, and long chats had it worst. The cause was not in the PDF preview. A style rule meant only for the settings pages was active on every page and made the browser redo the styling of a whole chat message each time a piece of content was added to it, which a PDF preview does well over a hundred times per page. That rule only decides whether the mouse pointer turns into a hand over the name of a setting, and it is now written so that it no longer costs anything noticeable outside the settings pages. The settings look and behave as before. <table> <tr><th>Long chat with three inline PDFs, scrolling one PDF down and back up</th><th>Before</th><th>After</th></tr> <tr><td>Time the browser spent redoing styles</td><td>15.1 s</td><td>0.24 s</td></tr> <tr><td>Longest freeze, desktop</td><td>6.6 s</td><td>0.05 s</td></tr> <tr><td>Longest freeze, phone sized screen with CPU slowed 4x</td><td>30 s</td><td>0.2 s</td></tr> <tr><td>Frames per second, desktop</td><td>35</td><td>60</td></tr> <tr><td>Adding one piece of content to a message</td><td>36 ms</td><td>under 1 ms</td></tr> </table> Fixes #35444
33 lines
996 B
Svelte
33 lines
996 B
Svelte
<script lang="ts">
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
export let label = '';
|
|
export let description = '';
|
|
export let className = '';
|
|
export let labelClassName = '';
|
|
|
|
const labelId = `admin-setting-${uuidv4()}`;
|
|
</script>
|
|
|
|
<div
|
|
class="group/setting-row has-[button[id$=-control]:enabled]:[&_label]:cursor-pointer has-[button[id$=-control]:disabled]:[&_label]:cursor-not-allowed flex items-center justify-between gap-4 {className}"
|
|
>
|
|
<label
|
|
for={`${labelId}-control`}
|
|
id={labelId}
|
|
class="min-w-0 text-xs text-base-600 transition-colors duration-150 group-hover/setting-row:text-base-900 group-focus-within/setting-row:text-base-900 dark:text-base-400 dark:group-hover/setting-row:text-white dark:group-focus-within/setting-row:text-white {labelClassName}"
|
|
>
|
|
<slot name="label">{label}</slot>
|
|
</label>
|
|
|
|
<div class="min-w-0">
|
|
<slot {labelId} />
|
|
</div>
|
|
</div>
|
|
|
|
{#if description}
|
|
<p class="-mt-1 text-[0.6875rem] text-base-400 dark:text-base-600">
|
|
{description}
|
|
</p>
|
|
{/if}
|