Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep known preview tabs while the session list refreshes #14955

Mergedsaphid(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/14955/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 226 additions and 3 deletions.

x
0 of 2 viewed, 2 left
219 additions and 0 deletionsapps/web/src/components/preview/previewSessionSync.test.tsAdded
View file
@@ -0,0 +1,219 @@
+import {
+ EnvironmentId,
+ ThreadId,
+ type PreviewEvent,
+ type PreviewListResult,
+ type ScopedThreadRef,
+} from "@t3tools/contracts";
+import * as Cause from "effect/Cause";
+import { AsyncResult, Atom } from "effect/reactivity";
+import { act, createElement } from "react";
+import { create, type ReactTestRenderer } from "react-test-renderer";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
+​
+// Only the transport is substituted. The hook, atom registry and preview
+// store run unchanged, including lazy evaluation and refresh notifications.
+type ListResult = AsyncResult.AsyncResult<PreviewListResult, never>;
+type EventResult = AsyncResult.AsyncResult<PreviewEvent, never>;
+const harness = vi.hoisted(() => ({
+ lists: new Map<
+ string,
+ {
+ box: { current: ListResult; requests: number };
+ atom: Atom.Writable<ListResult>;
+ }
+ >(),
+ events: new Map<string, Atom.Writable<EventResult>>(),
+}));
+​
+vi.mock("~/state/preview", async () => {
+ const { AsyncResult, Atom } = await import("effect/reactivity");