mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
refactor: extract ReactQueryProvider into dedicated context file
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c7d203366c
commit
8269f31921
3 changed files with 15 additions and 6 deletions
|
|
@ -3,6 +3,7 @@ import { Inter } from "next/font/google";
|
|||
import "./globals.css";
|
||||
|
||||
import AntdGlobalProvider from "@/contexts/AntdGlobalProvider";
|
||||
import ReactQueryProvider from "@/contexts/ReactQueryProvider";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
|
|
@ -20,7 +21,9 @@ export default function RootLayout({
|
|||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>
|
||||
<AntdGlobalProvider>{children}</AntdGlobalProvider>
|
||||
<ReactQueryProvider>
|
||||
<AntdGlobalProvider>{children}</AntdGlobalProvider>
|
||||
</ReactQueryProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { notification } from "antd";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { setNotificationInstance } from "@/components/molecules/notifications_manager";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
export default function AntdGlobalProvider({ children }: { children: React.ReactNode }) {
|
||||
const [api, contextHolder] = notification.useNotification();
|
||||
const initialized = useRef(false);
|
||||
|
|
@ -19,9 +16,9 @@ export default function AntdGlobalProvider({ children }: { children: React.React
|
|||
}, [api]);
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<>
|
||||
{contextHolder}
|
||||
{children}
|
||||
</QueryClientProvider>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
9
ui/litellm-dashboard/src/contexts/ReactQueryProvider.tsx
Normal file
9
ui/litellm-dashboard/src/contexts/ReactQueryProvider.tsx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
export default function ReactQueryProvider({ children }: { children: React.ReactNode }) {
|
||||
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue