fix: conditional classes, dynamic params, HMR and formatter

This commit is contained in:
2026-07-14 11:56:43 +05:30
parent 420706ca3b
commit 71480bb229
6 changed files with 240 additions and 17 deletions
+12 -2
View File
@@ -218,9 +218,19 @@ export async function startServer(opts: ServeOptions): Promise<RunningServer> {
// modules, rescan file routes, and ask browsers to morph in fresh HTML.
if (hmr && hub) {
const hotUpdate = async (files: string[]): Promise<void> => {
for (const relative of files) invalidateModule(resolve(appDir, relative));
// Allow VS Code/Bun to finish writing pasted content.
await new Promise((resolvePromise) => setTimeout(resolvePromise, 50));
Object.assign(router, buildRouter(appDir, { componentDirs: [uiComponentsDir()] }));
for (const relative of files) {
invalidateModule(resolve(appDir, relative));
}
Object.assign(
router,
buildRouter(appDir, {
componentDirs: [uiComponentsDir()],
}),
);
middleware.invalidate();
if (files.some((file) => file === "schemas" || file.startsWith("schemas/"))) {
+1 -1
View File
@@ -71,7 +71,7 @@ export function startWatcher(opts: WatchOptions): FSWatcher | undefined {
pendingFiles.add(rel);
pending.add(classify(rel));
if (timer) clearTimeout(timer);
timer = setTimeout(flush, 60); // debounce editor write bursts
timer = setTimeout(flush, 200); // debounce editor write bursts
});
} catch (err) {
console.warn("[wrnexus] file watching unavailable; HMR disabled", err);