Skip to content

Commit

Permalink
Revert "remove jQuery"
Browse files Browse the repository at this point in the history
This reverts commit 7200c77.
  • Loading branch information
cp-20 committed Mar 23, 2024
1 parent fa3ffdf commit 08674cd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions workspaces/client/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// import './side-effects';

import $ from 'jquery';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { SWRConfig } from 'swr';
Expand All @@ -14,18 +15,13 @@ const main = async () => {
await registerServiceWorker();
// await preloadImages();

document.addEventListener('load', () => {
const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error('Root element not found');
}

$(document).ready(() => {
if (window.location.pathname.startsWith('/admin')) {
ReactDOM.createRoot(rootElement!).render(<AdminApp />);
ReactDOM.createRoot($('#root').get(0)!).render(<AdminApp />);
} else {
ReactDOM.hydrateRoot(
rootElement!,
<SWRConfig value={{ revalidateOnFocus: false, revalidateOnReconnect: false }}>
$('#root').get(0)!,
<SWRConfig value={{ revalidateIfStale: true, revalidateOnFocus: false, revalidateOnReconnect: false }}>
<BrowserRouter>
<ClientApp />
</BrowserRouter>
Expand Down

0 comments on commit 08674cd

Please sign in to comment.