fix(electron): deep link handling in macos (#8713)

fix AF-1617
The issue is that handling deep link on opening new instance will access the screen module from electron too soon. Move the open call behind whenReady to mitigate the issue.
This commit is contained in:
pengx17
2024-11-06 02:02:56 +00:00
parent ed06e6b72c
commit 810d423c4d

View File

@@ -30,11 +30,15 @@ export function setupDeepLink(app: App) {
}
app.on('open-url', (event, url) => {
logger.log('open-url', url);
if (url.startsWith(`${protocol}://`)) {
event.preventDefault();
handleAffineUrl(url).catch(e => {
logger.error('failed to handle affine url', e);
});
app
.whenReady()
.then(() => handleAffineUrl(url))
.catch(e => {
logger.error('failed to handle affine url', e);
});
}
});