Skip to content

Commit 7bbe6fd

Browse files
committed
Refactor link handling to legacy fallback only triggers when window is focused
1 parent 331b54b commit 7bbe6fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

client/my-sites/customer-home/components/home-content/studio-deeplink.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ const openSyncUrlInStudio = ( studioSiteId: string, siteId: number ) => {
1010
const legacySchemeUrl = `${ STUDIO_URL_SCHEME_LEGACY }://${ path }`;
1111

1212
// Use new scheme for new Studio app versions.
13-
try {
14-
window.location.href = newSchemeUrl;
15-
} catch ( error ) {}
13+
window.location.href = newSchemeUrl;
1614

1715
// Fallback to legacy scheme for old Studio app versions. It will be blocked by the browser
1816
// if scheme is not registered.
1917
setTimeout( () => {
20-
window.location.href = legacySchemeUrl;
18+
if ( document.hasFocus() ) {
19+
window.location.href = legacySchemeUrl;
20+
}
2121
}, 1000 );
2222
};
2323

0 commit comments

Comments
 (0)