mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
fix: use existing useUISettings hook in useDisableShowBlog to avoid cache duplication
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a82c8c18b2
commit
98da524a9f
2 changed files with 3 additions and 30 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { useUISettingsFlags } from "./useUISettingsFlags";
|
||||
import { useUISettings } from "./uiSettings/useUISettings";
|
||||
|
||||
export function useDisableShowBlog(): boolean {
|
||||
const { data } = useUISettingsFlags();
|
||||
return data?.disable_show_blog ?? false;
|
||||
const { data } = useUISettings();
|
||||
return (data?.values?.disable_show_blog as boolean) ?? false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
import { getUiSettings } from "@/components/networking";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export interface UISettingsData {
|
||||
disable_model_add_for_internal_users: boolean;
|
||||
disable_team_admin_delete_team_user: boolean;
|
||||
enabled_ui_pages_internal_users: string[] | null;
|
||||
require_auth_for_public_ai_hub: boolean;
|
||||
forward_client_headers_to_llm_api: boolean;
|
||||
disable_show_blog: boolean;
|
||||
}
|
||||
|
||||
async function fetchUISettings(): Promise<UISettingsData> {
|
||||
// getUiSettings returns the raw response: { values: {...}, field_schema: {...} }
|
||||
const data = await getUiSettings();
|
||||
return data.values as UISettingsData;
|
||||
}
|
||||
|
||||
export function useUISettingsFlags() {
|
||||
return useQuery<UISettingsData>({
|
||||
queryKey: ["uiSettingsFlags"],
|
||||
queryFn: fetchUISettings,
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
gcTime: 10 * 60 * 1000,
|
||||
retry: 1,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue