2021-12-15 09:43:49 +00:00
|
|
|
import { ReactQueryDevtools } from 'react-query/devtools';
|
2022-05-15 07:01:08 +00:00
|
|
|
import { QueryClientProvider } from 'react-query';
|
2021-11-16 16:33:51 +00:00
|
|
|
import { UIRouterContextComponent } from '@uirouter/react-hybrid';
|
2022-05-15 07:01:08 +00:00
|
|
|
import { PropsWithChildren, StrictMode } from 'react';
|
2021-11-16 16:33:51 +00:00
|
|
|
|
2021-12-14 19:14:53 +00:00
|
|
|
import { UserProvider } from '@/portainer/hooks/useUser';
|
2022-03-08 12:14:23 +00:00
|
|
|
import { UIStateProvider } from '@/portainer/hooks/UIStateProvider';
|
2021-12-14 19:14:53 +00:00
|
|
|
|
2022-05-15 07:01:08 +00:00
|
|
|
import { createQueryClient } from './react-query';
|
|
|
|
|
|
|
|
const queryClient = createQueryClient();
|
2021-12-15 09:43:49 +00:00
|
|
|
|
2021-11-16 16:33:51 +00:00
|
|
|
export function RootProvider({ children }: PropsWithChildren<unknown>) {
|
2022-05-15 07:01:08 +00:00
|
|
|
const showReactQueryDevtools =
|
|
|
|
process.env.SHOW_REACT_QUERY_DEV_TOOLS === 'true';
|
2021-12-15 09:43:49 +00:00
|
|
|
|
2021-11-16 16:33:51 +00:00
|
|
|
return (
|
|
|
|
<StrictMode>
|
2021-12-15 09:43:49 +00:00
|
|
|
<QueryClientProvider client={queryClient}>
|
2022-03-08 12:14:23 +00:00
|
|
|
<UIStateProvider>
|
|
|
|
<UIRouterContextComponent>
|
|
|
|
<UserProvider>{children}</UserProvider>
|
|
|
|
</UIRouterContextComponent>
|
|
|
|
</UIStateProvider>
|
2021-12-15 09:43:49 +00:00
|
|
|
{showReactQueryDevtools && <ReactQueryDevtools />}
|
|
|
|
</QueryClientProvider>
|
2021-11-16 16:33:51 +00:00
|
|
|
</StrictMode>
|
|
|
|
);
|
|
|
|
}
|