Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,21 @@ export function usePersistentWebview({

const handleDomReady = () => {
markPersistentWebviewDomReady(paneId);
const webContentsId = wv.getWebContentsId();
const previousId = getRegisteredWebContentsId(paneId);
// Register on first load, or re-register if webContentsId changed
if (previousId !== webContentsId) {
setRegisteredWebContentsId(paneId, webContentsId);
registerBrowserRef.current({ paneId, webContentsId });

if (wv.isConnected) {
try {
const webContentsId = wv.getWebContentsId();
const previousId = getRegisteredWebContentsId(paneId);
// Register on first load, or re-register if webContentsId changed
if (previousId !== webContentsId) {
setRegisteredWebContentsId(paneId, webContentsId);
registerBrowserRef.current({ paneId, webContentsId });
}
} catch {
// WebView was detached between the isConnected check and
// getWebContentsId call — skip registration but still
// attempt to drain the pending navigation below.
}
}

const pendingUrl = getPendingPersistentWebviewNavigation(paneId);
Expand Down
Loading