From b245b905c0b9371cf88f8a55eb5f008b4a188e59 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:51:20 -0800 Subject: [PATCH] Preserve browser navigation and loading across asynchronous metadata reads --- .../navigation/browser-guest-metadata.test.ts | 30 ++- .../navigation/browser-guest-metadata.ts | 30 ++- ...edBrowserPagePane.failure-remount.test.tsx | 248 +++++++++++++++++- .../ClientHostedBrowserPagePane.test.tsx | 18 +- .../ClientHostedBrowserPagePane.tsx | 95 +++---- .../ReopenBrowserPageOnServerButton.tsx | 8 +- .../browser-page-context-menu-items.tsx | 5 +- .../assemble-chrome/browser-page-toolbar.tsx | 5 +- .../browser-pane/browser-reopen-on-server.ts | 6 +- .../client-hosted-browser-pane-test-rig.ts | 4 +- ...ient-hosted-browser-unavailable-notice.tsx | 6 +- .../describe-page/browser-page-url-display.ts | 5 +- .../bind-browser-page-webview-listeners.ts | 40 ++- .../browser-guest-metadata-cache.test.ts | 21 ++ .../browser-guest-metadata-cache.ts | 228 +++++++++++++--- .../host-guest/browser-page-guest-recovery.ts | 3 +- .../host-guest/browser-page-metadata.test.ts | 25 +- .../browser-page-webview-loading-handlers.ts | 4 +- .../use-browser-page-webview-shortcuts.ts | 9 +- .../navigate/browser-reload-action.ts | 5 +- .../navigate/navigate-browser-page-url.ts | 5 +- .../use-browser-page-webview-url-sync.ts | 9 +- .../use-client-hosted-page-url-submission.ts | 24 +- .../remote-browser-page-viewport.tsx | 2 +- 24 files changed, 683 insertions(+), 152 deletions(-) diff --git a/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.test.ts b/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.test.ts index d468c91873c..c73babff06c 100644 --- a/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.test.ts +++ b/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.test.ts @@ -2,11 +2,16 @@ import { EventEmitter } from 'node:events' import { describe, expect, it, vi } from 'vitest' import type { BrowserGuestMetadata } from '../../../../shared/browser/guest-lifecycle/browser-guest-metadata' import type { BrowserLoadError } from '../../../../shared/browser-workspace-types' -import { installBrowserGuestMetadata, publishBrowserGuestMetadata } from './browser-guest-metadata' +import { + installBrowserGuestMetadata, + publishBrowserGuestMetadata, + readBrowserGuestMetadata +} from './browser-guest-metadata' function fixture() { let url = 'https://example.test/start' let title = 'Start' + let loading = false let back = false let loadError: BrowserLoadError | null = null const emitter = new EventEmitter() @@ -15,7 +20,7 @@ function fixture() { isDestroyed: () => false, getURL: () => url, getTitle: () => title, - isLoadingMainFrame: () => false, + isLoadingMainFrame: () => loading, navigationHistory: { canGoBack: () => back, canGoForward: () => false } }) const reports: BrowserGuestMetadata[] = [] @@ -44,6 +49,9 @@ function fixture() { url = nextUrl title = nextTitle }, + setLoading: (value: boolean) => { + loading = value + }, setBack: () => { back = true } @@ -51,6 +59,24 @@ function fixture() { } describe('native guest metadata', () => { + it('samples native loading before navigation-start and keeps subsequent title reports current', () => { + const f = fixture() + f.setLoading(true) + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: fixture supplies the native metadata methods. + const state = readBrowserGuestMetadata(f.guest as unknown as Electron.WebContents) + expect(state).toMatchObject({ + url: 'https://example.test/start', + loading: true, + navigationRevision: 0 + }) + f.guest.emit('page-title-updated', {}, 'Current title') + expect(f.reports.at(-1)).toMatchObject({ title: 'Current title', loading: true }) + f.setLoading(false) + f.guest.emit('did-stop-loading') + expect(f.reports.at(-1)).toMatchObject({ url: 'https://example.test/start', loading: false }) + f.dispose() + }) + it('projects same-URL native history and retains it through a failed destination without publishing Chromium internals', () => { const f = fixture() // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: fixture supplies the production publisher native methods. diff --git a/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.ts b/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.ts index d787574d946..74c5aecdea3 100644 --- a/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.ts +++ b/src/main/browser/guest-lifecycle/navigation/browser-guest-metadata.ts @@ -61,10 +61,12 @@ export function installBrowserGuestMetadata({ ...readGuestNavigationState(guest) } } - const publish = (kind: BrowserGuestMetadata['kind'] = 'snapshot'): void => { + const publish = ( + kind: BrowserGuestMetadata['kind'] = 'snapshot' + ): BrowserGuestMetadata | null => { const next = read(kind) if (!next) { - return + return null } if ( previous && @@ -82,11 +84,12 @@ export function installBrowserGuestMetadata({ next.canGoForward === previous.canGoForward && next.navigationRevision === previous.navigationRevision ) { - return + return previous } next.revision = ++revision previous = next send(next) + return next } const onNavigate = (_event: Electron.Event, url: string): void => { if (isChromiumInternalErrorUrl(url)) { @@ -125,6 +128,12 @@ export function installBrowserGuestMetadata({ loading = true publish('start') } + const onStartLoading = (): void => { + if (guest.isLoadingMainFrame() && !isChromiumInternalErrorUrl(guest.getURL())) { + loading = true + publish('start') + } + } const onStop = (): void => { if ( isChromiumInternalErrorUrl(guest.getURL()) && @@ -149,11 +158,23 @@ export function installBrowserGuestMetadata({ loading = false publish('failure') } - projections.set(guest, { read: () => read(), publish: () => publish() }) + projections.set(guest, { + read: () => { + if (guest.isDestroyed()) { + return null + } + loading = guest.isLoadingMainFrame() + return publish() + }, + publish: () => { + publish() + } + }) guest.on('did-navigate', onNavigate) guest.on('did-navigate-in-page', onInPage) guest.on('page-title-updated', onTitle) guest.on('did-start-navigation', onStart) + guest.on('did-start-loading', onStartLoading) guest.on('did-stop-loading', onStop) guest.on('did-fail-load', onFail) return () => { @@ -165,6 +186,7 @@ export function installBrowserGuestMetadata({ guest.off('did-navigate-in-page', onInPage) guest.off('page-title-updated', onTitle) guest.off('did-start-navigation', onStart) + guest.off('did-start-loading', onStartLoading) guest.off('did-stop-loading', onStop) guest.off('did-fail-load', onFail) } diff --git a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.failure-remount.test.tsx b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.failure-remount.test.tsx index befd9481959..1c2505dca69 100644 --- a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.failure-remount.test.tsx +++ b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.failure-remount.test.tsx @@ -1,5 +1,10 @@ // @vitest-environment happy-dom -import { act, cleanup, render, screen } from '@testing-library/react' +import type { BrowserGuestMetadata } from '../../../../shared/browser/guest-lifecycle/browser-guest-metadata' +import { + cachedBrowserGuestMetadata, + clearBrowserGuestMetadata +} from './host-guest/browser-guest-metadata-cache' +import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { BrowserCertificateFailure, @@ -27,6 +32,7 @@ import { reportClientHostedGuestMetadata } from './client-hosted-browser-pane-test-rig' import { ClientHostedBrowserPagePane } from './ClientHostedBrowserPagePane' +import { clearBrowserPageDeferredNavigation } from './navigate/browser-page-deferred-navigation' const PLACEMENT = { kind: 'client' as const, @@ -52,21 +58,249 @@ beforeEach(() => { afterEach(() => { cleanup() + clearBrowserPageDeferredNavigation('page-a') vi.clearAllMocks() }) /** Worktree switches unmount chrome while retaining the guest; use the real store because clearing loadError also deletes its certificate record. */ describe('ClientHostedBrowserPagePane failure records across a remount', () => { + it('issues a staged request before native replay or an unanswered initial publication', async () => { + const idleA = reportClientHostedGuestMetadata({ + webContentsId: 42, + url: FAILED_URL, + title: 'Selfsigned', + loading: false + }) + mocks.attach.mockReturnValueOnce(null) + const staged = render() + submitUrl('https://requested.internal/b') + act(() => staged.unmount()) + vi.mocked(window.api.browser.publishClientPageMetadata).mockImplementation( + () => new Promise(() => {}) + ) + vi.mocked(window.api.browser.getGuestMetadata).mockResolvedValueOnce({ + ...idleA, + revision: idleA.revision + 1, + kind: 'snapshot', + loading: true + }) + await act(async () => { + render() + }) + expect(webview.loadURL).toHaveBeenCalledWith('https://requested.internal/b') + expect(storedPage()).toMatchObject({ + url: 'https://requested.internal/b', + title: 'https://requested.internal/b', + loading: true + }) + expect( + vi.mocked(window.api.browser.publishClientPageMetadata).mock.calls[0]?.[0].params + ).toMatchObject({ + url: 'https://requested.internal/b', + title: 'https://requested.internal/b', + loading: true + }) + }) + + it('keeps a requested page through old readback and a successor, then settles Stop at the native document', async () => { + const staleA = reportClientHostedGuestMetadata({ + webContentsId: 42, + url: FAILED_URL, + title: 'Selfsigned', + loading: false + }) + clearBrowserGuestMetadata() + let q1!: (state: BrowserGuestMetadata) => void + let q2!: (state: BrowserGuestMetadata) => void + vi.mocked(window.api.browser.getGuestMetadata) + .mockImplementationOnce( + () => + new Promise((resolve) => { + q1 = resolve + }) + ) + .mockImplementationOnce( + () => + new Promise((resolve) => { + q2 = resolve + }) + ) + let view!: ReturnType + await act(async () => { + view = render() + }) + submitUrl('https://requested.internal/b') + await act(async () => {}) + act(() => view.unmount()) + await act(async () => { + render() + }) + await act(async () => { + q1(staleA) + }) + expect(storedPage()).toMatchObject({ + url: 'https://requested.internal/b', + title: 'https://requested.internal/b', + loading: true + }) + const sample = reportClientHostedGuestMetadata({ + webContentsId: 42, + kind: 'snapshot', + url: FAILED_URL, + title: 'Outgoing A', + loading: true + }) + await act(async () => { + q2(sample) + }) + act(() => + reportClientHostedGuestMetadata({ + webContentsId: 42, + kind: 'title', + title: 'Outgoing A tick', + loading: true + }) + ) + expect(storedPage()).toMatchObject({ + url: 'https://requested.internal/b', + title: 'https://requested.internal/b', + loading: true + }) + expect( + vi.mocked(window.api.browser.publishClientPageMetadata).mock.lastCall?.[0].params + ).toMatchObject({ + url: 'https://requested.internal/b', + title: 'https://requested.internal/b', + loading: true + }) + expect(cachedBrowserGuestMetadata(webview)?.url).toBe('https://selfsigned.internal/') + await act(async () => + reportClientHostedGuestMetadata({ + webContentsId: 42, + kind: 'stop', + title: 'Selfsigned', + loading: false + }) + ) + expect(storedPage()).toMatchObject({ + url: 'https://selfsigned.internal/', + title: 'Selfsigned', + loading: false + }) + }) + + it('revalidates a healthy Stop after a command read failed', async () => { + render() + vi.mocked(window.api.browser.getGuestMetadata).mockRejectedValueOnce( + new Error('metadata read failed') + ) + submitUrl('https://requested.internal/b') + await act(async () => {}) + expect(storedPage()).toMatchObject({ url: 'https://requested.internal/b', loading: true }) + await act(async () => + reportClientHostedGuestMetadata({ webContentsId: 42, kind: 'stop', loading: false }) + ) + expect(storedPage()).toMatchObject({ + url: 'https://selfsigned.internal/', + title: 'Selfsigned', + loading: false + }) + }) + + it('adopts an already committed page on same-guest readiness after its read failed', async () => { + render() + let reject!: (error: Error) => void + vi.mocked(window.api.browser.getGuestMetadata).mockImplementationOnce( + () => + new Promise((_resolve, fail) => { + reject = fail + }) + ) + submitUrl('https://requested.internal/b') + await act(async () => {}) + act(() => + reportClientHostedGuestMetadata({ + webContentsId: 42, + kind: 'navigation', + url: 'https://requested.internal/b', + title: 'Committed B', + loading: true + }) + ) + await act(async () => { + reject(new Error('metadata read failed')) + }) + await act(async () => { + webview.dispatchEvent(new Event('dom-ready')) + }) + expect(storedPage()).toMatchObject({ + url: 'https://requested.internal/b', + title: 'Committed B', + loading: true + }) + }) + + it('shows a hidden committed document and its live title while another load is pending', async () => { + let resolve!: (state: BrowserGuestMetadata) => void + const view = render() + vi.mocked(window.api.browser.getGuestMetadata).mockImplementationOnce( + () => + new Promise((done) => { + resolve = done + }) + ) + submitUrl('https://requested.internal/b') + await act(async () => {}) + act(() => view.unmount()) + reportClientHostedGuestMetadata({ + webContentsId: 42, + kind: 'navigation', + url: 'https://current.internal/c', + title: 'Current C', + loading: true + }) + const sample = reportClientHostedGuestMetadata({ + webContentsId: 42, + kind: 'snapshot', + loading: true + }) + await act(async () => { + resolve(sample) + }) + expect(storedPage().loading).toBe(true) + render() + expect(storedPage()).toMatchObject({ + url: 'https://current.internal/c', + title: 'Current C', + loading: true + }) + act(() => + reportClientHostedGuestMetadata({ + webContentsId: 42, + kind: 'title', + title: 'Current C live', + loading: true + }) + ) + expect(storedPage()).toMatchObject({ + url: 'https://current.internal/c', + title: 'Current C live', + loading: true + }) + }) + it('retains the saved title until a first committed document exists, including a failed first load', () => { reportClientHostedGuestMetadata({ webContentsId: 42, navigationRevision: 0, url: '', title: '', - kind: 'snapshot' + kind: 'snapshot', + loading: true }) render() expect(storedPage().title).toBe('Selfsigned') + expect(storedPage().loading).toBe(true) act(() => reportClientHostedGuestMetadata({ webContentsId: 42, kind: 'start', loading: true })) expect(storedPage().title).toBe('Selfsigned') act(() => reportClientHostedGuestMetadata({ webContentsId: 42, kind: 'stop', loading: false })) @@ -307,3 +541,13 @@ function createWebview(): Electron.WebviewTag & { getURL: ReturnType) { + const current = ui.props.browserTab + useAppStore.setState({ browserPagesByWorkspace: { [current.workspaceId]: [current] } }) return renderWithProviders(ui, { wrapper: TooltipProvider }) } @@ -211,17 +213,11 @@ describe('ClientHostedBrowserPagePane', () => { expect(screen.getByPlaceholderText('Find in page...')).not.toBeNull() act(() => reportClientHostedGuestMetadata({ webContentsId: 7, kind: 'stop' })) expect(screen.getByPlaceholderText('Find in page...')).not.toBeNull() - act(() => - reportClientHostedGuestMetadata({ - webContentsId: 7, - kind: 'navigation', - navigationRevision: 2 - }) - ) + act(() => webview.dispatchEvent(new Event('did-navigate'))) expect(screen.queryByPlaceholderText('Find in page...')).toBeNull() }) - it('restores the committed address after an attempted navigation is stopped', () => { + it('restores the committed address after an attempted navigation is stopped', async () => { const { webview } = createWebview() reportClientHostedGuestMetadata({ webContentsId: 7, @@ -251,7 +247,9 @@ describe('ClientHostedBrowserPagePane', () => { ) act(() => screen.getByLabelText('Address').blur()) onSetUrl.mockClear() - act(() => reportClientHostedGuestMetadata({ webContentsId: 7, kind: 'stop', loading: false })) + await act(async () => + reportClientHostedGuestMetadata({ webContentsId: 7, kind: 'stop', loading: false }) + ) expect(screen.getByLabelText('Address').value).toBe( 'https://example.internal/a' ) diff --git a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx index 81de05b3c4d..a73a64d1625 100644 --- a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx +++ b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx @@ -6,7 +6,11 @@ import { BrowserLinkStatusBubble } from './assemble-chrome/browser-link-status-b import { useAppStore } from '@/store' import type { BrowserLoadError } from '../../../../shared/browser-workspace-types' import { createBrowserClientPageLoadFailureHandler } from './browser-client-page-guest-metadata' -import { subscribeBrowserGuestMetadata } from './host-guest/browser-guest-metadata-cache' +import { + issueBrowserGuestNavigation, + browserGuestPreservesRequestedDocument, + subscribeBrowserGuestMetadata +} from './host-guest/browser-guest-metadata-cache' import { redactKagiSessionToken } from '../../../../shared/browser-url' import { forgetBrowserClientPageMetadataReports, @@ -130,14 +134,15 @@ export function ClientHostedBrowserPagePane({ webviewRef, activeLoadFailureRef, onUpdatePageState, + onSetUrl, setAddressBarValue }) const runDeferredNavigation = useEffectEvent(navigateToUrl) - const readPendingPageMetadata = useEffectEvent(() => ({ - url: browserTab.url, - title: browserTab.title, - loading: browserTab.loading - })) + const readCurrentPage = useEffectEvent(() => + useAppStore + .getState() + .browserPagesByWorkspace[workspaceId]?.find((page) => page.id === browserTab.id) + ) // The guest lives in a body-level host that paints above the pane, so the cursor joins it there. const getAgentCursorHost = useCallback( () => webviewRef.current?.parentElement ?? null, @@ -197,75 +202,72 @@ export function ClientHostedBrowserPagePane({ }) webviewRef.current = webview setAttachmentError(null) - let appliedUrl: string | null = null const receiveMetadata = (state: BrowserGuestMetadata | null): void => { if (!state || state.kind === 'retired') { guestLoss.lose('unreadable') return } + const pending = readCurrentPage() + if (!pending) { + guestAvailable = false + releaseGuest() + return + } const metadata = { - url: redactKagiSessionToken(state.url || 'about:blank'), + url: redactKagiSessionToken(state.url), title: state.title, loading: state.loading, canGoBack: state.canGoBack, canGoForward: state.canGoForward } + const validDocument = + Boolean(state.url) && !state.errorPage && !state.loadError && !state.hasCertificateFailure + const presentDocument = + validDocument && !browserGuestPreservesRequestedDocument(webview, state.url, pending.url) if ( state.kind === 'navigation' || - ((state.kind === 'stop' || (state.kind === 'snapshot' && !state.loading)) && - state.navigationRevision > 0 && - !state.loadError && - !state.hasCertificateFailure && - !state.errorPage) + ((state.kind === 'stop' || (state.kind === 'snapshot' && !state.loading)) && validDocument) ) { activeLoadFailureRef.current = null } - if (state.kind === 'navigation') { - setFindOpen(false) - } if (state.loadError) { activeLoadFailureRef.current = state.loadError } const activeLoadFailure = activeLoadFailureRef.current const observeUrl = - state.navigationRevision > 0 && - !state.errorPage && - !state.loadError && - !state.hasCertificateFailure && + presentDocument && + !activeLoadFailure && (state.kind === 'navigation' || state.kind === 'in-page' || state.kind === 'stop' || - (state.kind === 'snapshot' && state.navigationRevision > 0 && !state.loading)) - if (observeUrl && !activeLoadFailure) { - if (appliedUrl !== metadata.url) { - appliedUrl = metadata.url + state.kind === 'snapshot') + if (observeUrl) { + if (pending.url !== metadata.url) { setUrlFromGuest(browserTab.id, metadata.url, { preserveLoadError: true }) } setAddressBarValueFromPage(toDisplayUrl(metadata.url)) } updatePageStateFromGuest(browserTab.id, { - ...(state.navigationRevision > 0 ? { title: metadata.title } : {}), - ...(state.kind === 'snapshot' && state.navigationRevision === 0 - ? {} - : { loading: metadata.loading }), + ...(presentDocument && !activeLoadFailure ? { title: metadata.title } : {}), + loading: metadata.loading, canGoBack: metadata.canGoBack, canGoForward: metadata.canGoForward, loadError: activeLoadFailure }) - if (state.navigationRevision > 0) { - publisher.publish(metadata) - } else if (state.kind !== 'title') { - const pending = readPendingPageMetadata() - publisher.publish({ - ...metadata, - ...pending, - loading: state.kind === 'snapshot' ? pending.loading : state.loading - }) + const current = readCurrentPage() + if (!current) { + return } - if (observeUrl || state.kind === 'title') { + publisher.publish({ + ...metadata, + ...(presentDocument && !activeLoadFailure ? {} : { url: current.url, title: current.title }) + }) + if (observeUrl || (state.kind === 'title' && presentDocument && !activeLoadFailure)) { recordHistoryFromGuest(metadata.url, getBrowserDisplayTitle(metadata.title, metadata.url)) } } + const onNavigate = (): void => setFindOpen(false) + webview.addEventListener('did-navigate', onNavigate) const onFailLoad = createBrowserClientPageLoadFailureHandler(webview, (loadError) => { activeLoadFailureRef.current = loadError updatePageStateFromGuest(browserTab.id, { loading: false, loadError }) @@ -275,21 +277,22 @@ export function ClientHostedBrowserPagePane({ const cleanupGuest = (): void => { unsubscribeMetadata() webview.removeEventListener('did-fail-load', onFailLoad) + webview.removeEventListener('did-navigate', onNavigate) guestLoss.dispose() publisher.dispose() forgetBrowserClientPageMetadataReports(browserTab.id) attachment.detach() } releaseGuest = cleanupGuest + const deferredUrl = consumeBrowserPageDeferredNavigation(browserTab.id) + if (deferredUrl) { + runDeferredNavigation(deferredUrl) + } unsubscribeMetadata = subscribeBrowserGuestMetadata(browserTab.id, webview, receiveMetadata) if (!guestAvailable) { cleanupGuest() return cleanupGuest } - const deferredUrl = consumeBrowserPageDeferredNavigation(browserTab.id) - if (deferredUrl) { - runDeferredNavigation(deferredUrl) - } return cleanupGuest }, [ browserTab.id, @@ -334,8 +337,10 @@ export function ClientHostedBrowserPagePane({ controls={{ canGoBack: browserTab.canGoBack, canGoForward: browserTab.canGoForward, - goBack: () => webviewRef.current?.goBack(), - goForward: () => webviewRef.current?.goForward(), + goBack: () => + issueBrowserGuestNavigation(webviewRef.current, (webview) => webview.goBack()), + goForward: () => + issueBrowserGuestNavigation(webviewRef.current, (webview) => webview.goForward()), reload: () => reload.runReloadTrigger('button'), navigate: navigateToUrl }} @@ -394,7 +399,7 @@ export function ClientHostedBrowserPagePane({ ) : isBlankBrowserUrl(browserTab.url) ? ( diff --git a/src/renderer/src/components/browser-pane/ReopenBrowserPageOnServerButton.tsx b/src/renderer/src/components/browser-pane/ReopenBrowserPageOnServerButton.tsx index 207a94ae24c..b01733c1135 100644 --- a/src/renderer/src/components/browser-pane/ReopenBrowserPageOnServerButton.tsx +++ b/src/renderer/src/components/browser-pane/ReopenBrowserPageOnServerButton.tsx @@ -25,12 +25,12 @@ export function reopenOnServerCaveat(t: Translate = translate): string { export function ReopenBrowserPageOnServerButton({ environmentId, worktreeId, - lastCommittedUrl, + reopenUrl, className }: { environmentId: string worktreeId: string - lastCommittedUrl: string | null | undefined + reopenUrl: string | null | undefined className?: string }): React.JSX.Element { const t = useTranslate() @@ -54,7 +54,7 @@ export function ReopenBrowserPageOnServerButton({ pendingTimerRef.current = null setShowPending(true) }, REOPEN_PENDING_FEEDBACK_DELAY_MS) - void reopenBrowserPageOnServer({ environmentId, worktreeId, lastCommittedUrl }) + void reopenBrowserPageOnServer({ environmentId, worktreeId, reopenUrl }) .then((created) => { if (!created) { toast.error( @@ -73,7 +73,7 @@ export function ReopenBrowserPageOnServerButton({ setShowPending(false) setPending(false) }) - }, [clearPendingTimer, environmentId, lastCommittedUrl, worktreeId]) + }, [clearPendingTimer, environmentId, reopenUrl, worktreeId]) return (