Skip to content

Commit 3a98a7c

Browse files
authored
Remove routes for compiler (#1510)
## Description This PR enables React Compiler for additional directories and simplifies event handlers in route components: 1. Added `src/components/shared/Authentication` and `src/routes` to the enabled directories in `react-compiler.config.js` 2. Removed comments and reorganized the directory list for better readability 3. Simplified event handlers in `ErrorPage.tsx` and `NotFoundPage.tsx` by removing unnecessary `useCallback` hooks 4. Fixed formatting in `RunRow.tsx` component ## Type of Change - [x] Improvement - [x] Cleanup/Refactor ## Checklist - [ ] I have tested this does not break current pipelines / runs functionality - [ ] I have tested the changes on staging ## Test Instructions 1. Verify that the application functions correctly with React Compiler enabled for the additional directories 2. Confirm that navigation and error handling work as expected in the routes components
1 parent 7473449 commit 3a98a7c

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

react-compiler.config.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@ export const REACT_COMPILER_ENABLED_DIRS = [
1414
"src/components/shared/ExecutionDetails",
1515
"src/components/shared/QuickStart",
1616
"src/components/shared/Status",
17-
18-
// 2-5 useCallback/useMemo
19-
"src/components/shared/CodeViewer", // 2
20-
"src/components/shared/FullscreenElement", // 2
21-
"src/components/shared/CopyText", // 3
22-
"src/components/shared/TaskDetails", // 4
23-
"src/components/shared/GitHubAuth", // 5
17+
"src/components/shared/CodeViewer",
18+
"src/components/shared/FullscreenElement",
19+
"src/components/shared/CopyText",
20+
"src/components/shared/TaskDetails",
21+
"src/components/shared/GitHubAuth",
22+
"src/components/shared/Authentication",
23+
"src/routes",
2424

2525
// 6-10 useCallback/useMemo
26-
// "src/routes", // 6
2726
// "src/components/shared/ComponentEditor", // 6
2827
// "src/components/shared/Settings", // 6
2928
// "src/components/shared/HuggingFaceAuth", // 8
30-
"src/components/shared/Authentication", // 9
29+
3130
// "src/components/shared/GitHubLibrary", // 9
3231

3332
// 11-20 useCallback/useMemo

src/routes/ErrorPage.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { useRouter } from "@tanstack/react-router";
2-
import { type ErrorComponentProps } from "@tanstack/react-router";
3-
import { useCallback } from "react";
1+
import { type ErrorComponentProps, useRouter } from "@tanstack/react-router";
42

53
import { InfoBox } from "@/components/shared/InfoBox";
64
import { Button } from "@/components/ui/button";
@@ -10,13 +8,13 @@ import { Paragraph, Text } from "@/components/ui/typography";
108
export default function ErrorPage({ error }: ErrorComponentProps) {
119
const router = useRouter();
1210

13-
const handleRefresh = useCallback(() => {
11+
const handleRefresh = () => {
1412
window.location.reload();
15-
}, []);
13+
};
1614

17-
const handleGoHome = useCallback(() => {
15+
const handleGoHome = () => {
1816
router.navigate({ to: "/" });
19-
}, [router]);
17+
};
2018

2119
return (
2220
<div className="min-h-screen flex items-center justify-center bg-background p-4">

src/routes/NotFoundPage.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useRouter } from "@tanstack/react-router";
2-
import { useCallback } from "react";
32

43
import { Button } from "@/components/ui/button";
54
import { BlockStack } from "@/components/ui/layout";
@@ -8,13 +7,13 @@ import { Paragraph, Text } from "@/components/ui/typography";
87
export default function NotFoundPage() {
98
const router = useRouter();
109

11-
const handleGoHome = useCallback(() => {
10+
const handleGoHome = () => {
1211
router.navigate({ to: "/" });
13-
}, [router]);
12+
};
1413

15-
const handleGoBack = useCallback(() => {
14+
const handleGoBack = () => {
1615
router.history.back();
17-
}, [router]);
16+
};
1817

1918
return (
2019
<div className="min-h-screen flex items-center justify-center bg-background p-4">

0 commit comments

Comments
 (0)