blob: f5cd876d8304a51fec0e15effaf496c96507ef00 [file] [log] [blame]
simon26e79f72022-10-05 22:16:08 -04001/*
2 * Copyright (C) 2022 Savoir-faire Linux Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
13 *
14 * You should have received a copy of the GNU Affero General Public
15 * License along with this program. If not, see
16 * <https://www.gnu.org/licenses/>.
17 */
simond47ef9e2022-09-28 22:24:28 -040018'use strict';
19import './index.scss';
idillon5815c732022-09-16 13:54:45 -040020import './i18n';
Larbi Gharibe9af9732021-03-31 15:08:01 +010021
idillon08f77172022-09-13 19:14:17 -040022import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
Ziwei Wang4eaa1e22023-01-17 16:02:59 -050023import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
simon07b4eb02022-09-29 17:50:26 -040024import { createRoot } from 'react-dom/client';
25import { Provider } from 'react-redux';
simon3f5f3e72022-11-08 21:01:57 -050026import { RouterProvider } from 'react-router-dom';
simon07b4eb02022-09-29 17:50:26 -040027
idillon3470d072022-11-22 15:22:34 -050028import CustomThemeProvider from './contexts/CustomThemeProvider';
simond8ca2f22022-10-11 23:30:55 -040029import { store } from './redux/store';
simon3f5f3e72022-11-08 21:01:57 -050030import { router } from './router';
idillon08f77172022-09-13 19:14:17 -040031
32const queryClient = new QueryClient({
33 defaultOptions: {
34 queries: {
35 cacheTime: Infinity, // websocket is responsible to tell when data needs to be updated
36 },
37 },
simond47ef9e2022-09-28 22:24:28 -040038});
idillon5e897432022-09-16 13:28:09 -040039
simond47ef9e2022-09-28 22:24:28 -040040const container = document.getElementById('root');
simon218d3d12022-10-01 17:27:01 -040041if (!container) {
42 throw new Error('Failed to get the root element');
43}
idillon169f64f2022-09-16 14:01:22 -040044const root = createRoot(container);
45root.render(
46 <Provider store={store}>
simon8b4756f2022-11-27 17:15:50 -050047 {/* TODO: Put back StrictMode once issues with calling are fixed */}
48 {/* <StrictMode> */}
49 <QueryClientProvider client={queryClient}>
50 <CustomThemeProvider>
51 <RouterProvider router={router} />
Ziwei Wang4eaa1e22023-01-17 16:02:59 -050052 <ReactQueryDevtools initialIsOpen={false} />
simon8b4756f2022-11-27 17:15:50 -050053 </CustomThemeProvider>
54 </QueryClientProvider>
55 {/* </StrictMode> */}
idillon169f64f2022-09-16 14:01:22 -040056 </Provider>
57);