From 55f5ed580f0e8ab5cc0dad2a524066af8187b667 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Thu, 24 Jul 2025 11:49:35 -0700 Subject: [PATCH] fix: use loading state for loading indicator, better error messages --- core/config/ConfigHandler.ts | 6 +++--- gui/src/components/modelSelection/ModelSelect.tsx | 3 +-- gui/src/redux/slices/configSlice.ts | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 1ca09b1e2..f936196fa 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -438,7 +438,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [], + errors: [{ message: "Current profile not found", fatal: true }], configLoadInterrupted: true, }; } @@ -494,7 +494,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [], + errors: [{ message: "Current profile not found", fatal: true }], configLoadInterrupted: true, }; } @@ -507,7 +507,7 @@ export class ConfigHandler { if (!this.currentProfile) { return { config: undefined, - errors: [], + errors: [{ message: "Current profile not found", fatal: true }], configLoadInterrupted: true, }; } diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index d474fe58a..a93009965 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -11,7 +11,6 @@ import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { AddModelForm } from "../../forms/AddModelForm"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { EMPTY_CONFIG } from "../../redux/slices/configSlice"; import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; import { updateSelectedModelByRole } from "../../redux/thunks/updateSelectedModelByRole"; import { @@ -94,6 +93,7 @@ function ModelSelect() { const isInEdit = useAppSelector((store) => store.session.isInEdit); const config = useAppSelector((state) => state.config.config); + const isConfigLoading = useAppSelector((state) => state.config.loading); const ideMessenger = useContext(IdeMessengerContext); const buttonRef = useRef(null); const [options, setOptions] = useState([]); @@ -192,7 +192,6 @@ function ModelSelect() { ); } - const isConfigLoading = config === EMPTY_CONFIG; const hasNoModels = allModels?.length === 0; return ( diff --git a/gui/src/redux/slices/configSlice.ts b/gui/src/redux/slices/configSlice.ts index 8766014a2..0deb9f6e4 100644 --- a/gui/src/redux/slices/configSlice.ts +++ b/gui/src/redux/slices/configSlice.ts @@ -68,6 +68,7 @@ export const configSlice = createSlice({ } else { state.config = config; } + state.loading = false; }, updateConfig: ( state,