TTP -> MTP, A lot of other stuff #21
4 changed files with 17 additions and 45 deletions
(fix): hot-reloading not working
(fix): other stuff
commit
d9bfdb655d
2
apps/web/.gitignore
vendored
2
apps/web/.gitignore
vendored
|
|
@ -22,3 +22,5 @@ dist-ssr
|
|||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
.android
|
||||
|
|
|
|||
|
|
@ -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<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({
|
||||
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(),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -523,11 +523,11 @@ export default function Screen() {
|
|||
|
||||
return (
|
||||
<Wrapper
|
||||
key={getMessageRenderKey(message)}
|
||||
userId={message.SenderId}
|
||||
loading={<Skeleton className="w-30 h-5" />}
|
||||
component={(user) => (
|
||||
<Message
|
||||
key={getMessageRenderKey(message)}
|
||||
grouped={isGrouped}
|
||||
message={message}
|
||||
user={user}
|
||||
|
|
|
|||
Loading…
Reference in a new issue