Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: keep an appearance edit made while the personalization load is in flight (#15953)
Daniel Han1af0f78447b4
diff --git a/studio/frontend/src/features/profile/hooks/use-personalization-sync.ts b/studio/frontend/src/features/profile/hooks/use-personalization-sync.tsindex 8c8f9bee233..6b2931babaf 100644--- a/studio/frontend/src/features/profile/hooks/use-personalization-sync.ts+++ b/studio/frontend/src/features/profile/hooks/use-personalization-sync.ts@@ -228,10 +228,16 @@ export function usePersonalizationSync(enabled: boolean): void {}let cancelled = false;const localeHydrationController = new AbortController();+ const customizationBeforeLoad =+ useAppearanceCustomStore.getState().customization;void (async () => {try {const remote = await loadPersonalization();if (cancelled) return;+ // Changed while the request was in flight: a newer local edit, which the server must not overwrite.+ const editedDuringLoad =+ useAppearanceCustomStore.getState().customization !==+ customizationBeforeLoad;if (remote.saved) {// Legacy records return server defaults for missing fields: keep and re-push the local value.// A record with <field>Saved=true still wins.@@ -266,10 +272,12 @@ export function usePersonalizationSync(enabled: boolean): void {remote.version,PERSONALIZATION_VERSION,);- const localCustomization = latestCustomizationRef.current;+ const localCustomization =+ useAppearanceCustomStore.getState().customization;const keepLocalCustomization =- remote.customizationSaved === false &&- !isDefaultCustomization(localCustomization);+ editedDuringLoad ||+ (remote.customizationSaved === false &&+ !isDefaultCustomization(localCustomization));const keepLocalChatWidth =remote.chatWidthSaved === false ||remote.appearance.customization?.chatWidth === undefined;diff --git a/studio/frontend/tests/personalization-locale-hydration.test.ts b/studio/frontend/tests/personalization-locale-hydration.test.tsindex 34ec6430571..5212b005da6 100644--- a/studio/frontend/tests/personalization-locale-hydration.test.ts+++ b/studio/frontend/tests/personalization-locale-hydration.test.ts@@ -183,6 +183,8 @@ function setup(chatWidthSaved?: boolean;sentAttachmentsSaved?: boolean;};+ // Holds the personalization GET open until it resolves.+ remoteGate?: Promise<void>;} = {},) {const runTimers = installWindow();@@ -232,8 +234,10 @@ function setup(isDefaultCustomization: (value: unknown) =>Object.keys(value as object).length === 0,isPalette: (value: unknown) => typeof value === "string",- loadPersonalization: () =>- Promise.resolve(options.remote ?? remotePersonalization("de")),+ loadPersonalization: async () => {+ await options.remoteGate;+ return options.remote ?? remotePersonalization("de");+ },migrateShippedSidebarNavDefault: (value: unknown) => value,sanitizeCustomization,savePersonalization: (data: SavedPayload) => {@@ -281,6 +285,10 @@ function setup(runTimers,saves,customization: () => customization,+ // What a settings control does: a new customization object in the store.+ edit(next: Record<string, unknown>) {+ customization = sanitizeCustomization({ ...customization, ...next });+ },rename(displayName: string) {profile = { ...profile, displayName };},@@ -475,3 +483,54 @@ test("an older server without attachment display keys preserves the local choiceassert.equal(app.customization().sentAttachments, "list");app.host.unmount();});++test("an edit made while the personalization request is in flight is not overwritten by it", async () => {+ // The server still holds an older size (a save cut short by a reload); the user changes it+ // before that answer arrives.+ let releaseRemote!: () => void;+ const remote = remotePersonalization("auto");+ const app = setup("stalled", {+ localCustomization: { uiFontSize: 12 },+ remote: {+ ...remote,+ version: 5,+ appearance: { ...remote.appearance, customization: { uiFontSize: 20 } },+ },+ remoteGate: new Promise<void>((resolve) => {+ releaseRemote = resolve;+ }),+ });+ app.render();+ await settle();++ app.edit({ uiFontSize: 15 });+ app.render();+ releaseRemote();+ await settle();+ app.render();++ assert.equal(app.customization().uiFontSize, 15);+ app.runTimers();+ await settle();+ assert.equal(app.saves.length, 1);+ assert.equal(app.saves[0]?.appearance.customization.uiFontSize, 15);+ app.host.unmount();+});++test("without an edit in flight the saved server customization still wins", async () => {+ const remote = remotePersonalization("auto");+ const app = setup("stalled", {+ localCustomization: { uiFontSize: 12 },+ remote: {+ ...remote,+ version: 5,+ appearance: { ...remote.appearance, customization: { uiFontSize: 20 } },+ },+ });+ app.render();+ await settle();+ app.render();++ assert.equal(app.customization().uiFontSize, 20);+ app.host.unmount();+});