mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-03 18:17:56 -05:00
fix: chat freezes for seconds when scrolling inside an inline PDF preview (#35452)
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
This commit is contained in:
1 parent
b645d6a9c8
commit
bde9278693
5 files changed
+19
-10
No files matched your search
@@ -9,11 +9,13 @@
|
||||
const labelId = `admin-setting-${uuidv4()}`;
|
||||
</script>
|
||||
|
||||
<div class="group/setting-row flex items-center justify-between gap-4 {className}">
|
||||
<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 group-has-[button[id$=-control]:enabled]/setting-row:cursor-pointer group-has-[button[id$=-control]:disabled]/setting-row:cursor-not-allowed 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}"
|
||||
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>
|
||||
|
||||
@@ -724,14 +724,16 @@
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
{#each webhooks as webhook}
|
||||
<div class="group/setting-row flex w-full gap-2 items-center">
|
||||
<div
|
||||
class="group/setting-row has-[button[id$=-control]:enabled]:[&_label]:cursor-pointer has-[button[id$=-control]:disabled]:[&_label]:cursor-not-allowed flex w-full gap-2 items-center"
|
||||
>
|
||||
<div
|
||||
class="flex-1 min-w-0 flex gap-1.5 items-center {webhook.enabled ? '' : 'opacity-50'}"
|
||||
>
|
||||
<div class="outline-hidden w-full bg-transparent text-sm truncate">
|
||||
<label
|
||||
for={`webhook-${webhook.id}-control`}
|
||||
class="font-normal text-base-600 dark:text-base-400 transition-colors duration-150 group-hover/setting-row:text-base-900 group-focus-within/setting-row:text-base-900 dark:group-hover/setting-row:text-white dark:group-focus-within/setting-row:text-white group-has-[button[id$=-control]:enabled]/setting-row:cursor-pointer group-has-[button[id$=-control]:disabled]/setting-row:cursor-not-allowed"
|
||||
class="font-normal text-base-600 dark:text-base-400 transition-colors duration-150 group-hover/setting-row:text-base-900 group-focus-within/setting-row:text-base-900 dark:group-hover/setting-row:text-white dark:group-focus-within/setting-row:text-white"
|
||||
>
|
||||
{webhook.id === 'default' ? $i18n.t('Default webhook') : webhook.name}
|
||||
</label>
|
||||
|
||||
@@ -314,12 +314,14 @@
|
||||
.filter((event) => target.events.includes(event.event))
|
||||
.map((event) => $i18n.t(event.label))
|
||||
.join(', ')}
|
||||
<div class="group/setting-row flex items-center gap-3 px-1 py-1.5">
|
||||
<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 gap-3 px-1 py-1.5"
|
||||
>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<label
|
||||
for={`notification-${target.id}-control`}
|
||||
class="truncate text-[0.71875rem] text-base-600 dark:text-base-400 transition-colors duration-150 group-hover/setting-row:text-base-900 group-focus-within/setting-row:text-base-900 dark:group-hover/setting-row:text-white dark:group-focus-within/setting-row:text-white group-has-[button[id$=-control]:enabled]/setting-row:cursor-pointer group-has-[button[id$=-control]:disabled]/setting-row:cursor-not-allowed"
|
||||
class="truncate text-[0.71875rem] text-base-600 dark:text-base-400 transition-colors duration-150 group-hover/setting-row:text-base-900 group-focus-within/setting-row:text-base-900 dark:group-hover/setting-row:text-white dark:group-focus-within/setting-row:text-white"
|
||||
>
|
||||
{target.id}
|
||||
</label>
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
const labelId = `user-setting-${uuidv4()}`;
|
||||
</script>
|
||||
|
||||
<div class="group/setting-row flex items-center justify-between gap-2.5 {className}">
|
||||
<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-2.5 {className}"
|
||||
>
|
||||
<label
|
||||
id={labelId}
|
||||
for={`${labelId}-control`}
|
||||
class="min-w-0 text-xs text-base-600 group-has-[button[id$=-control]:enabled]/setting-row:cursor-pointer group-has-[button[id$=-control]:disabled]/setting-row:cursor-not-allowed 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}"
|
||||
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>
|
||||
|
||||
@@ -131,9 +131,10 @@
|
||||
let fontFamilyInput = '';
|
||||
let showTextScaleSlider = false;
|
||||
let showFontFamilyInput = false;
|
||||
const settingRowClass = 'group/setting-row flex items-center justify-between gap-2.5';
|
||||
const settingRowClass =
|
||||
'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-2.5';
|
||||
const settingLabelClass =
|
||||
'min-w-0 text-xs text-base-600 group-has-[button[id$=-control]:enabled]/setting-row:cursor-pointer group-has-[button[id$=-control]:disabled]/setting-row:cursor-not-allowed 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';
|
||||
'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';
|
||||
const settingControlClass = 'flex shrink-0 items-center justify-end gap-1.5';
|
||||
const sectionHeadingClass = 'mt-4 text-xs text-base-600 dark:text-base-500';
|
||||
const firstSectionHeadingClass = 'text-xs text-base-600 dark:text-base-500';
|
||||
|
||||
Reference in new issue
Block a user