Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): browser tabs no longer go blank when the tab list reorders #13799

Mergedmkiera(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/13799/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 169 additions and 1 deletion.

x
0 of 2 viewed, 2 left
163 additions and 0 deletionsapps/web/src/browser/ElectronBrowserHost.browser.test.tsxAdded
View file
@@ -0,0 +1,163 @@
+import { scopeThreadRef } from "@t3tools/client-runtime/environment";
+import {
+ DEFAULT_CLIENT_SETTINGS,
+ EnvironmentId,
+ ThreadId,
+ type ClientSettings,
+ type DesktopPreviewBridge,
+ type PreviewSessionSnapshot,
+} from "@t3tools/contracts";
+import { act } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
+​
+const mocks = vi.hoisted(() => ({
+ getClientSettings: vi.fn<() => Promise<ClientSettings | null>>(),
+ setClientSettings: vi.fn<(settings: ClientSettings) => Promise<void>>(),
+ createTab: vi.fn<DesktopPreviewBridge["createTab"]>(),
+ closeTab: vi.fn<DesktopPreviewBridge["closeTab"]>(),
+ registerWebview: vi.fn<DesktopPreviewBridge["registerWebview"]>(),
+ getPreviewConfig: vi.fn<DesktopPreviewBridge["getPreviewConfig"]>(),
+}));
+​
+vi.mock(import("~/env"), async (original) => ({ ...(await original()), isElectron: true }));
+​
+vi.mock(import("~/state/session"), async (original) => ({
+ ...(await original()),
+ useEnvironmentScope: () => true,
+}));
+​
+vi.mock(import("~/localApi"), async (original) => {