Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tauri/src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ const useStore = create<State & Actions>()(
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,
});
}),
})),
Expand Down
3 changes: 3 additions & 0 deletions tauri/src/windows/settings/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down
Loading