Description
The general settings manager doesn't handle query errors. If fetching the search space fails, the form renders with empty fields and no indication that something went wrong.
Files to Update
surfsense_web/components/settings/general-settings-manager.tsx (lines 26–34)
What to Do
- Destructure
isError from the useQuery call:
const {
data: searchSpace,
isLoading: loading,
isError,
refetch: fetchSearchSpace,
} = useQuery({
queryKey: cacheKeys.searchSpaces.detail(searchSpaceId.toString()),
queryFn: () => searchSpacesApiService.getSearchSpace({ id: searchSpaceId }),
enabled: !!searchSpaceId,
});
- Add an error state check after the loading check (before the form renders):
if (isError) {
return (
<div className="flex flex-col items-center justify-center gap-3 py-8 text-center">
<p className="text-sm text-destructive">Failed to load settings.</p>
<Button variant="outline" size="sm" onClick={() => fetchSearchSpace()}>
Retry
</Button>
</div>
);
}
This gives users clear feedback and a way to recover instead of showing a broken empty form.
Description
The general settings manager doesn't handle query errors. If fetching the search space fails, the form renders with empty fields and no indication that something went wrong.
Files to Update
surfsense_web/components/settings/general-settings-manager.tsx(lines 26–34)What to Do
isErrorfrom theuseQuerycall:This gives users clear feedback and a way to recover instead of showing a broken empty form.