fix: conditional classes, dynamic params, HMR and formatter
This commit is contained in:
@@ -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/"))) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user