From d9bfdb655d96b7d611d0374c557437314a0f2bfe Mon Sep 17 00:00:00 2001 From: Alois Date: Mon, 6 Jul 2026 23:25:48 +0200 Subject: [PATCH] (fix): hot-reloading not working (fix): other stuff --- apps/web/.gitignore | 2 ++ apps/web/vite.config.ts | 48 ++++++++++------------------------- packages/chat/src/context.tsx | 10 -------- packages/chat/src/screen.tsx | 2 +- 4 files changed, 17 insertions(+), 45 deletions(-) diff --git a/apps/web/.gitignore b/apps/web/.gitignore index a547bf3..8952e07 100644 --- a/apps/web/.gitignore +++ b/apps/web/.gitignore @@ -22,3 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? + +.android diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index b3d396e..b0ea9d5 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -3,7 +3,7 @@ import type { IncomingMessage, ServerResponse } from "node:http"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; -import { defineConfig, normalizePath, type Plugin } from "vite"; +import { defineConfig, type Plugin } from "vite"; import react from "@vitejs/plugin-react"; import tailwindcss from "@tailwindcss/vite"; import { mtp } from "mtp/vite"; @@ -51,38 +51,6 @@ function deepFilterAssetHeaders(rootDir: string): Plugin { }; } -function restartOnMtpSourceChange(srcDir: string): Plugin { - const watchedDir = normalizePath(realpathSync(srcDir)); - - return { - name: "restart-on-mtp-source-change", - apply: "serve", - configureServer(server) { - server.watcher.add(watchedDir); - let restartTimer: ReturnType | null = null; - - const restart = (file: string) => { - if (!normalizePath(file).startsWith(`${watchedDir}/`)) { - return; - } - - if (restartTimer) { - clearTimeout(restartTimer); - } - - restartTimer = setTimeout(() => { - restartTimer = null; - void server.restart(); - }, 50); - }; - - server.watcher.on("add", restart); - server.watcher.on("change", restart); - server.watcher.on("unlink", restart); - }, - }; -} - export default defineConfig({ base: "./", clearScreen: false, @@ -141,6 +109,8 @@ export default defineConfig({ : undefined, watch: { ignored: ["**/src-tauri/**"], + usePolling: true, + interval: 100, }, }, envPrefix: ["VITE_", "TAURI_ENV_*"], @@ -181,8 +151,18 @@ export default defineConfig({ }, plugins: [ deepFilterAssetHeaders(resolve(appDir, "public")), - restartOnMtpSourceChange(resolve(appDir, "../../packages/mtp/src")), mtp({ typeMaps: resolve(appDir, "../../type-maps.yaml") }), + { + name: "workspace-realpath-resolution", + enforce: "post", + config() { + return { + resolve: { + preserveSymlinks: false, + }, + }; + }, + }, react(), tailwindcss(), ], diff --git a/packages/chat/src/context.tsx b/packages/chat/src/context.tsx index e6a2bf2..a2b55ff 100644 --- a/packages/chat/src/context.tsx +++ b/packages/chat/src/context.tsx @@ -172,16 +172,6 @@ export default function Provider({ children }: { children: ReactNode }) { return currentChatSecretState.value; }, [currentChatSecretState, userIdValue]); - // Chat secret debugging - useEffect(() => { - if (!currentChatSecret) return; - - const hex = Array.from(currentChatSecret, (b) => - b.toString(16).padStart(2, "0"), - ).join(""); - log(3, "chat", "yellow", "Chat secret (sensitive)", hex); - }, [currentChatSecret]); - useEffect(() => { if (!userIdValue) return; diff --git a/packages/chat/src/screen.tsx b/packages/chat/src/screen.tsx index c1affae..3b1c5e4 100644 --- a/packages/chat/src/screen.tsx +++ b/packages/chat/src/screen.tsx @@ -523,11 +523,11 @@ export default function Screen() { return ( } component={(user) => (