Repository navigation
Closed
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- On Windows desktop with Ubuntu installed in WSL, open Settings, then Connections.
- Leave Settings while keeping T3 Code open.
- Install Debian as another WSL distribution in Windows.
- Wait at least thirty seconds.
- Return to Settings, then Connections, and open the WSL backend selector.
Expected behavior
The selector lists both Ubuntu and the newly installed Debian distribution.
Actual behavior
The selector still lists only Ubuntu. Reopening Settings keeps using the earlier distribution list until another action refreshes WSL state or the app restarts.
Impact
Minor bug or occasional failure. Windows desktop users who install WSL distributions while T3 Code is open cannot select them on subsequent visits to Connections.
Version or commit
main at 705c7f2479. The cause is at apps/web/src/state/desktopWslState.ts:51.
Environment
Linux x64, the repository's own tests.
Logs or stack traces
Reopening stale WSL state should expose the current distributionsAutomated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/apps/web/src/state/desktopWslState.test.ts b/apps/web/src/state/desktopWslState.test.ts
new file mode 100644
index 0000000000..798eb79284
--- /dev/null
+++ b/apps/web/src/state/desktopWslState.test.ts
@@ -0,0 +1,54 @@
+import type { DesktopWslState } from "@t3tools/contracts";
+import { AsyncResult, AtomRegistry } from "effect/reactivity";
+import { expect, it, vi } from "vite-plus/test";
+
+import { desktopWslStateAtom } from "./desktopWslState";
+
+it("reloads WSL distributions when stale state is mounted again", async () => {
+ const initial: DesktopWslState = {
+ enabled: false,
+ distro: null,
+ available: true,
+ wslOnly: false,
+ distros: [{ name: "Ubuntu", isDefault: true, version: 2 }],
+ preflightError: null,
+ };
+ let current = initial;
+ vi.stubGlobal("window", { desktopBridge: { getWslState: async () => current } });
+ using now = vi.spyOn(Date, "now").mockReturnValue(1_000_000);
+ const tasks: Array<() => void> = [];
+ const registry = AtomRegistry.make({
+ scheduleTask: (task) => {
+ tasks.push(task);
+ return () => {};
+ },
+ });
+ try {
+ const unmount = registry.mount(desktopWslStateAtom);
+ await vi.waitFor(() => {
+ expect(AsyncResult.getOrElse(registry.get(desktopWslStateAtom), () => null)).toEqual(initial);
+ });
+ unmount();
+ for (const task of tasks.splice(0)) task();
+
+ current = {
+ ...initial,
+ distros: [...initial.distros, { name: "Debian", isDefault: false, version: 2 }],
+ };
+ now.mockReturnValue(1_060_000);
+ const unmountAgain = registry.mount(desktopWslStateAtom);
+ try {
+ await vi.waitFor(() => {
+ expect(
+ AsyncResult.getOrElse(registry.get(desktopWslStateAtom), () => null)?.distros,
+ "Reopening stale WSL state should expose the current distributions",
+ ).toEqual(current.distros);
+ });
+ } finally {
+ unmountAgain();
+ }
+ } finally {
+ registry.dispose();
+ vi.unstubAllGlobals();
+ }
+});cd apps/web && pnpm exec vp test run src/state/desktopWslState.test.tsWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
Activity