From ac911fd533b785c740e63901dda584253a6c903b Mon Sep 17 00:00:00 2001 From: Iason Paraskevopoulos Date: Wed, 27 May 2026 18:19:36 +0100 Subject: [PATCH] fix: fix custom url out of sync --- tauri/src/store/store.ts | 4 +++- tauri/src/windows/settings/main.tsx | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tauri/src/store/store.ts b/tauri/src/store/store.ts index d9a82f3..b247bb3 100644 --- a/tauri/src/store/store.ts +++ b/tauri/src/store/store.ts @@ -157,9 +157,11 @@ const useStore = create()( reset: () => set((state) => { // First clear the auth token to prevent re-fetching - // Then reset all other state properties + // Then reset all other state properties, but preserve customServerUrl + const preservedCustomServerUrl = state.customServerUrl; Object.assign(state, { ...initialState, + customServerUrl: preservedCustomServerUrl, }); }), })), diff --git a/tauri/src/windows/settings/main.tsx b/tauri/src/windows/settings/main.tsx index 818a513..9900078 100644 --- a/tauri/src/windows/settings/main.tsx +++ b/tauri/src/windows/settings/main.tsx @@ -10,6 +10,7 @@ import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-quer import { tauriUtils } from "@/windows/window-utils"; import { OS, URLS } from "@/constants"; import posthog from "posthog-js"; +import useStore from "@/store/store"; const queryClient = new QueryClient(); @@ -290,6 +291,7 @@ function SettingsWindow() { if (e.key === "Enter") { const trimmed = serverUrl.trim() || null; await tauriUtils.setHoppServerUrl(trimmed); + useStore.getState().setCustomServerUrl(trimmed); posthog.capture("custom_backend_url_changed"); refetchSettings(); } @@ -298,6 +300,7 @@ function SettingsWindow() { const trimmed = serverUrl.trim() || null; if (trimmed !== settings.hopp_server_url) { await tauriUtils.setHoppServerUrl(trimmed); + useStore.getState().setCustomServerUrl(trimmed); posthog.capture("custom_backend_url_changed"); refetchSettings(); }