Surface all enabled providers in the model selector with inline loading and error states instead of silently hiding non-ready ones. Tap any row to drill in; loading and error states show in the drill-down body, with a Retry button on error. Providers with no models render a synthetic "Default" row so every provider's drill-down has symmetric structure. Redesign the per-provider settings sheet: search lives in the header, discovered and custom models share one scrolling list, and the footer hosts action buttons. Diagnostic and "Add model" each open as their own sub-sheet, so neither expands inline or shifts the surrounding layout. Snapshot refresh now keeps cached data visible: setQueryData replaces the cache atomically and sibling-scope caches are invalidated (not removed), so refreshing a provider no longer blanks its row. Search inputs across the app are uncontrolled — onChangeText drives parent state, and resetKey remounts the field when an explicit reset is needed — to avoid RN's controlled-input flicker. Adds a dev-only mock-slow provider whose discovery never resolves, so the 30s snapshot timeout produces a real error and lets loading and timeout-error UI be exercised end to end.
25 lines
553 B
TypeScript
25 lines
553 B
TypeScript
import { create } from "zustand";
|
|
|
|
interface ProviderSettingsTarget {
|
|
serverId: string;
|
|
provider: string;
|
|
}
|
|
|
|
interface ProviderSettingsStoreState {
|
|
serverId: string | null;
|
|
provider: string | null;
|
|
open: (target: ProviderSettingsTarget) => void;
|
|
close: () => void;
|
|
}
|
|
|
|
export const useProviderSettingsStore = create<ProviderSettingsStoreState>()((set) => ({
|
|
serverId: null,
|
|
provider: null,
|
|
open: ({ serverId, provider }) => {
|
|
set({ serverId, provider });
|
|
},
|
|
close: () => {
|
|
set({ serverId: null, provider: null });
|
|
},
|
|
}));
|