Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/web/src/components/preview/addBrowserSurface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export async function addBrowserSurface<E>(input: {
...(source.navStatus._tag === "Idle" ? {} : { url: source.navStatus.url }),
...(source.profileId === undefined ? {} : { profileId: source.profileId }),
...(source.viewport === undefined ? {} : { viewport: source.viewport }),
...(source.zoomFactor === undefined ? {} : { zoomFactor: source.zoomFactor }),
...(source.colorScheme === undefined ? {} : { colorScheme: source.colorScheme }),
runtime: source.runtime ?? "desktop",
}),
});
Expand Down
20 changes: 20 additions & 0 deletions apps/web/src/components/preview/openPreviewSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,26 @@ describe("openPreviewSession", () => {
});
});

it("duplicates a server browser with its zoom and appearance, as reopening a closed tab does", async () => {
const source: PreviewSessionSnapshot = {
...snapshot,
runtime: "server",
zoomFactor: 1.5,
colorScheme: "dark",
};
useRightPanelStore.getState().openBrowser(threadRef, source.tabId);
const openPreview = vi.fn(async () =>
AsyncResult.success({ ...source, tabId: "duplicate-tab" }),
);

await addBrowserSurface({ threadRef, openPreview, duplicateFrom: source });

expect(openPreview).toHaveBeenCalledWith({
environmentId: threadRef.environmentId,
input: expect.objectContaining({ runtime: "server", zoomFactor: 1.5, colorScheme: "dark" }),
});
});

it.each(["session", "link"] as const)(
"does not open a %s with unread settings and uses the saved profile on retry",
async (entryPoint) => {
Expand Down
Loading