Rework provider selector and settings UX
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.
This commit is contained in:
@@ -99,14 +99,39 @@ describe("combined model selector data", () => {
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("excludes providers that are not ready", () => {
|
||||
it("surfaces non-ready providers with their state-specific selection", () => {
|
||||
expect(
|
||||
buildSelectableProviderSelectorProviders([
|
||||
snapshotEntry({ provider: "loading-provider", status: "loading", models: [] }),
|
||||
snapshotEntry({ provider: "error-provider", status: "error", models: [] }),
|
||||
snapshotEntry({ provider: "unavailable-provider", status: "unavailable", models: [] }),
|
||||
snapshotEntry({
|
||||
provider: "error-provider",
|
||||
status: "error",
|
||||
error: "boom",
|
||||
models: [],
|
||||
}),
|
||||
snapshotEntry({
|
||||
provider: "unavailable-provider",
|
||||
status: "unavailable",
|
||||
models: [],
|
||||
}),
|
||||
]),
|
||||
).toEqual([]);
|
||||
).toEqual([
|
||||
{
|
||||
id: "loading-provider",
|
||||
label: "loading-provider",
|
||||
modelSelection: { kind: "loading" },
|
||||
},
|
||||
{
|
||||
id: "error-provider",
|
||||
label: "error-provider",
|
||||
modelSelection: { kind: "error", message: "boom" },
|
||||
},
|
||||
{
|
||||
id: "unavailable-provider",
|
||||
label: "unavailable-provider",
|
||||
modelSelection: { kind: "error", message: "Unavailable" },
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("builds selector providers from an already-curated provider list", () => {
|
||||
|
||||
Reference in New Issue
Block a user