From a3cf2126ccaf15e31dd08108cf1365dcf6fbe002 Mon Sep 17 00:00:00 2001
From: Stephen Liang <538214+stephenliang@users.noreply.github.com>
Date: Wed, 3 Dec 2025 14:53:01 -0800
Subject: [PATCH] feat(router): integrate TanStack Router
- Added TanStack Router plugin to Vite configuration for enhanced routing capabilities.
- Added a stub of the `/projects/[labType]/[channelId]/edit` route
- Implemented `@/` alias for the `src` root
---
dashboard/app/views/app/index.html.haml | 2 +-
frontend/apps/studio/config/vite.json | 2 +-
.../apps/studio/entrypoints/application.ts | 11 -
.../apps/studio/entrypoints/application.tsx | 18 +
frontend/apps/studio/index.html | 2 +-
frontend/apps/studio/package.json | 3 +
.../apps/studio/src/modules/router/index.ts | 24 +
frontend/apps/studio/src/routeTree.gen.ts | 78 +
.../studio/src/{App.tsx => routes/__root.tsx} | 16 +-
frontend/apps/studio/src/routes/index.tsx | 9 +
.../projects/$labType/$channelId/edit.tsx | 17 +
frontend/apps/studio/vite.config.ts | 6 +
frontend/yarn.lock | 1909 ++++++++++++++++-
13 files changed, 2020 insertions(+), 77 deletions(-)
delete mode 100644 frontend/apps/studio/entrypoints/application.ts
create mode 100644 frontend/apps/studio/entrypoints/application.tsx
create mode 100644 frontend/apps/studio/src/modules/router/index.ts
create mode 100644 frontend/apps/studio/src/routeTree.gen.ts
rename frontend/apps/studio/src/{App.tsx => routes/__root.tsx} (74%)
create mode 100644 frontend/apps/studio/src/routes/index.tsx
create mode 100644 frontend/apps/studio/src/routes/projects/$labType/$channelId/edit.tsx
diff --git a/dashboard/app/views/app/index.html.haml b/dashboard/app/views/app/index.html.haml
index 366eada26cbc6..2d8f706dfdb18 100644
--- a/dashboard/app/views/app/index.html.haml
+++ b/dashboard/app/views/app/index.html.haml
@@ -6,6 +6,6 @@
= vite_client_tag
= vite_react_refresh_tag
- = vite_typescript_tag 'application'
+ = vite_typescript_tag 'application.tsx'
%body
%div{id: 'vite-root'}
diff --git a/frontend/apps/studio/config/vite.json b/frontend/apps/studio/config/vite.json
index b64d5e4f83a25..53fd2d5b03663 100644
--- a/frontend/apps/studio/config/vite.json
+++ b/frontend/apps/studio/config/vite.json
@@ -7,7 +7,7 @@
"development": {
"host": "0.0.0.0",
"autoBuild": true,
- "publicOutputDir": "vite-dev",
+ "publicOutputDir": "app",
"port": 3036
}
}
diff --git a/frontend/apps/studio/entrypoints/application.ts b/frontend/apps/studio/entrypoints/application.ts
deleted file mode 100644
index 8e0dc04104c13..0000000000000
--- a/frontend/apps/studio/entrypoints/application.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import {createElement} from 'react';
-import {createRoot} from 'react-dom/client';
-
-import App from '../src/App';
-
-// This root element is added to the page in dashboard/views/app/index.html.haml via rails_vite
-const mount = document.getElementById('vite-root');
-
-if (mount) {
- createRoot(mount).render(createElement(App));
-}
diff --git a/frontend/apps/studio/entrypoints/application.tsx b/frontend/apps/studio/entrypoints/application.tsx
new file mode 100644
index 0000000000000..414d98be8114f
--- /dev/null
+++ b/frontend/apps/studio/entrypoints/application.tsx
@@ -0,0 +1,18 @@
+import {RouterProvider} from '@tanstack/react-router';
+import {StrictMode} from 'react';
+import {createRoot} from 'react-dom/client';
+
+import router from '@/modules/router';
+
+// This root element is added to the page in dashboard/views/app/index.html.haml via rails_vite
+const mount = document.getElementById('vite-root');
+
+if (mount) {
+ const root = createRoot(mount);
+
+ root.render(
+