@@ -368,31 +368,37 @@ export function reconcilePreviewServerSessions(
368368 } ) ;
369369}
370370
371+ function isPreviewStateEqual (
372+ previous : DesktopPreviewOverlay | null ,
373+ next : DesktopPreviewOverlay | null ,
374+ ) {
375+ return (
376+ previous === next ||
377+ ( previous !== null &&
378+ next !== null &&
379+ previous . hasWebContents === next . hasWebContents &&
380+ previous . canGoBack === next . canGoBack &&
381+ previous . canGoForward === next . canGoForward &&
382+ previous . loading === next . loading &&
383+ previous . zoomFactor === next . zoomFactor &&
384+ previous . pictureInPicture === next . pictureInPicture &&
385+ previous . colorScheme === next . colorScheme &&
386+ previous . audioMuted === next . audioMuted &&
387+ previous . audible === next . audible &&
388+ previous . controller === next . controller &&
389+ previous . favicon ?. dataUrl === next . favicon ?. dataUrl &&
390+ previous . favicon ?. pageUrl === next . favicon ?. pageUrl &&
391+ previous . favicon ?. capturedAt === next . favicon ?. capturedAt )
392+ ) ;
393+ }
394+
371395export function applyPreviewDesktopState (
372396 ref : ScopedThreadRef ,
373397 tabId : string ,
374398 overlay : DesktopPreviewOverlay | null ,
375399) : void {
376400 updateThreadPreviewState ( ref , ( current ) => {
377- const previous = current . desktopByTabId [ tabId ] ?? null ;
378- if (
379- previous === overlay ||
380- ( previous !== null &&
381- overlay !== null &&
382- previous . hasWebContents === overlay . hasWebContents &&
383- previous . canGoBack === overlay . canGoBack &&
384- previous . canGoForward === overlay . canGoForward &&
385- previous . loading === overlay . loading &&
386- previous . zoomFactor === overlay . zoomFactor &&
387- previous . pictureInPicture === overlay . pictureInPicture &&
388- previous . colorScheme === overlay . colorScheme &&
389- previous . audioMuted === overlay . audioMuted &&
390- previous . audible === overlay . audible &&
391- previous . controller === overlay . controller &&
392- previous . favicon ?. dataUrl === overlay . favicon ?. dataUrl &&
393- previous . favicon ?. pageUrl === overlay . favicon ?. pageUrl &&
394- previous . favicon ?. capturedAt === overlay . favicon ?. capturedAt )
395- ) {
401+ if ( isPreviewStateEqual ( current . desktopByTabId [ tabId ] ?? null , overlay ) ) {
396402 return current ;
397403 }
398404 const desktopByTabId = { ...current . desktopByTabId } ;
0 commit comments