mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
779 B
TypeScript
28 lines
779 B
TypeScript
import React, { PropsWithChildren } from 'react';
|
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
import { isDevelopment } from '../utils/environment';
|
|
import { queryClient } from './';
|
|
|
|
/**
|
|
* 缓存上下文
|
|
*/
|
|
export const CacheProvider: React.FC<PropsWithChildren> = React.memo(
|
|
(props) => {
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
{props.children}
|
|
|
|
{/* TODO: 待放到web上 */}
|
|
{isDevelopment && (
|
|
<ReactQueryDevtools
|
|
position="bottom-left"
|
|
toggleButtonProps={{ style: { left: 8, bottom: 50 } }}
|
|
/>
|
|
)}
|
|
</QueryClientProvider>
|
|
);
|
|
}
|
|
);
|
|
CacheProvider.displayName = 'CacheProvider';
|