(fix): hot-reloading not working
Some checks failed
/ release (push) Has been cancelled
/ build-desktop (linux) (push) Has been cancelled
/ build-web (push) Has been cancelled
/ build-mobile (push) Has been cancelled

(fix): other stuff
This commit is contained in:
Alois 2026-07-06 23:25:48 +02:00
commit d9bfdb655d
4 changed files with 17 additions and 45 deletions

2
apps/web/.gitignore vendored
View file

@ -22,3 +22,5 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
.android

View file

@ -3,7 +3,7 @@ import type { IncomingMessage, ServerResponse } from "node:http";
import { dirname, resolve } from "node:path"; import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url"; 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 react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from "@tailwindcss/vite";
import { mtp } from "mtp/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<typeof setTimeout> | 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({ export default defineConfig({
base: "./", base: "./",
clearScreen: false, clearScreen: false,
@ -141,6 +109,8 @@ export default defineConfig({
: undefined, : undefined,
watch: { watch: {
ignored: ["**/src-tauri/**"], ignored: ["**/src-tauri/**"],
usePolling: true,
interval: 100,
}, },
}, },
envPrefix: ["VITE_", "TAURI_ENV_*"], envPrefix: ["VITE_", "TAURI_ENV_*"],
@ -181,8 +151,18 @@ export default defineConfig({
}, },
plugins: [ plugins: [
deepFilterAssetHeaders(resolve(appDir, "public")), deepFilterAssetHeaders(resolve(appDir, "public")),
restartOnMtpSourceChange(resolve(appDir, "../../packages/mtp/src")),
mtp({ typeMaps: resolve(appDir, "../../type-maps.yaml") }), mtp({ typeMaps: resolve(appDir, "../../type-maps.yaml") }),
{
name: "workspace-realpath-resolution",
enforce: "post",
config() {
return {
resolve: {
preserveSymlinks: false,
},
};
},
},
react(), react(),
tailwindcss(), tailwindcss(),
], ],

View file

@ -172,16 +172,6 @@ export default function Provider({ children }: { children: ReactNode }) {
return currentChatSecretState.value; return currentChatSecretState.value;
}, [currentChatSecretState, userIdValue]); }, [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(() => { useEffect(() => {
if (!userIdValue) return; if (!userIdValue) return;

View file

@ -523,11 +523,11 @@ export default function Screen() {
return ( return (
<Wrapper <Wrapper
key={getMessageRenderKey(message)}
userId={message.SenderId} userId={message.SenderId}
loading={<Skeleton className="w-30 h-5" />} loading={<Skeleton className="w-30 h-5" />}
component={(user) => ( component={(user) => (
<Message <Message
key={getMessageRenderKey(message)}
grouped={isGrouped} grouped={isGrouped}
message={message} message={message}
user={user} user={user}