Skip to content

Commit 5b5488f

Browse files
committed
♻️ Simplify JotaiDevTools implementation and remove suspense
1 parent d72a1f6 commit 5b5488f

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
import { lazy, Suspense } from 'react';
1+
import { DevTools, DevToolsProps } from 'jotai-devtools';
22

3-
import { DevToolsProps } from 'jotai-devtools';
3+
if (import.meta.env.DEV) import('jotai-devtools/styles.css');
44

5-
const LazyDevTools = lazy(() =>
6-
Promise.all([
7-
import('jotai-devtools'),
8-
import('jotai-devtools/styles.css'),
9-
]).then(([m]) => ({ default: m.DevTools })),
10-
);
11-
12-
export function JotaiDevTools(props: DevToolsProps) {
5+
export function JotaiDevTools({ theme = 'dark', ...props }: DevToolsProps) {
136
if (!import.meta.env.DEV) return null;
14-
return (
15-
<Suspense fallback={null}>
16-
<LazyDevTools {...props} />
17-
</Suspense>
18-
);
7+
return <DevTools theme={theme} {...props} />;
198
}

src/features/syntax-editor/pages/syntax-editor-root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function SyntaxEditorRoot() {
88
return (
99
<Layout>
1010
<Provider store={analysisStore}>
11-
<JotaiDevTools store={analysisStore} theme="dark" />
11+
<JotaiDevTools />
1212
<Outlet />
1313
</Provider>
1414
</Layout>

0 commit comments

Comments
 (0)