fix: default pinned models stop applying after a user's first page load (#28069)

Changing "Default Pinned Models" in admin settings had no effect for anyone who had already opened Open WebUI once. The sidebar copied the admin default into that user's own settings the first time it rendered and saved it to the server, which marked them as having customized their pins, so every later change to the default was ignored for them. Merely loading the page was enough, the user never had to touch a pin.

The default is now resolved for display only, through a shared store that falls back to the admin list while the user has no pins of their own, the same way default models already work. Nothing is written to the user's settings until they actually pin, unpin or reorder something, at which point their choice takes over for good. Unpinning everything still persists an empty list rather than snapping back to the default.

Users whose settings were already overwritten by the old behaviour keep that copy, since a stored pin list cannot be told apart from a deliberate one.

Fixes a drag-reorder path that mixed sidebar positions with stored ones, and stops the sidebar section reopening itself after any unrelated settings change.
This commit is contained in:
Classic298
2026-08-17 00:22:51 -06:00
committed by GitHub
parent 1a376ac17f
commit 1756c9d5d2
10 changed files with 99 additions and 129 deletions
+7 -9
View File
@@ -17,6 +17,7 @@
config,
mobile,
models as _models,
pinnedModels,
settings,
user,
workspaceActions
@@ -292,15 +293,12 @@
};
const pinModelHandler = async (modelId) => {
let pinnedModels = $settings?.pinnedModels ?? [];
if (pinnedModels.includes(modelId)) {
pinnedModels = pinnedModels.filter((id) => id !== modelId);
} else {
pinnedModels = [...new Set([...pinnedModels, modelId])];
}
settings.set({ ...$settings, pinnedModels: pinnedModels });
settings.set({
...$settings,
pinnedModels: $pinnedModels.includes(modelId)
? $pinnedModels.filter((id) => id !== modelId)
: [...$pinnedModels, modelId]
});
await updateUserSettings(localStorage.token, { ui: $settings });
};
@@ -15,7 +15,7 @@
import Pin from '$lib/components/icons/Pin.svelte';
import PinSlash from '$lib/components/icons/PinSlash.svelte';
import { config, user as currentUser, settings } from '$lib/stores';
import { config, user as currentUser, pinnedModels, settings } from '$lib/stores';
import Link from '$lib/components/icons/Link.svelte';
const i18n = getContext('i18n');
@@ -131,14 +131,14 @@
class="select-none flex h-[1.6875rem] w-full cursor-pointer items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-gray-900 dark:hover:text-gray-100"
on:click={() => runAndClose(() => pinModelHandler(model?.id))}
>
{#if ($settings?.pinnedModels ?? []).includes(model?.id)}
{#if $pinnedModels.includes(model?.id)}
<PinSlash />
{:else}
<Pin />
{/if}
<div class="flex items-center">
{#if ($settings?.pinnedModels ?? []).includes(model?.id)}
{#if $pinnedModels.includes(model?.id)}
{$i18n.t('Hide from Sidebar')}
{:else}
{$i18n.t('Keep in Sidebar')}