fix(settings): restore image tab scrolling and dev websocket routing

- route dashboard WebSocket traffic through /ws to avoid Vite HMR collisions

- run the dev entrypoint with node so bun run dev stays stable in this repo

- restore the Image settings scroll container contract and add regression coverage
This commit is contained in:
Tam Nhu Tran committed 2026-04-01 16:57:30 -04:00
1 parent 36acf9f190
commit 7a783d0714
6 files changed
+132 -188

No files matched your search

@@ -1,4 +1,4 @@
import { afterEach, describe, expect, it } from 'bun:test';
import { afterEach, describe, expect, it, mock } from 'bun:test';
import type { AddressInfo } from 'net';
import { startServer } from '../../../src/web-server';
@@ -15,6 +15,8 @@ afterEach(async () => {
instance.cleanup();
await new Promise<void>((resolve) => instance.server.close(() => resolve()));
}
mock.restore();
});
describe('startServer host binding', () => {
@@ -41,4 +43,27 @@ describe('startServer host binding', () => {
const address = instance.server.address() as AddressInfo;
expect(['0.0.0.0', '::']).toContain(address.address);
});
it('attaches Vite HMR to the existing HTTP server in dev mode', async () => {
let viteConfig: Record<string, unknown> | undefined;
mock.module('vite', () => ({
createServer: async (config: Record<string, unknown>) => {
viteConfig = config;
return {
middlewares: (_req: unknown, _res: unknown, next: () => void) => next(),
};
},
}));
const instance = await startServer({ port: 0, dev: true });
instances.push(instance);
expect(viteConfig).toBeDefined();
const serverConfig = viteConfig?.server as
| { middlewareMode?: boolean; hmr?: { server?: unknown } }
| undefined;
expect(serverConfig?.middlewareMode).toBe(true);
expect(serverConfig?.hmr?.server).toBe(instance.server);
});
});