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.
21 lines
569 B
TypeScript
21 lines
569 B
TypeScript
import React, { PropsWithChildren } from 'react';
|
|
import { asyncStoragePersister, queryClient } from './';
|
|
import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
|
|
|
|
/**
|
|
* 缓存上下文
|
|
*/
|
|
export const CacheProvider: React.FC<PropsWithChildren> = React.memo(
|
|
(props) => {
|
|
return (
|
|
<PersistQueryClientProvider
|
|
client={queryClient}
|
|
persistOptions={{ persister: asyncStoragePersister }}
|
|
>
|
|
{props.children}
|
|
</PersistQueryClientProvider>
|
|
);
|
|
}
|
|
);
|
|
CacheProvider.displayName = 'CacheProvider';
|