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 committed 2024-11-06 02:02:56 +00:00
1 parent ed06e6b72c
commit fcd4f8c4ff
1 file changed
+5 -1
@@ -30,9 +30,13 @@ 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 => {
app
.whenReady()
.then(() => handleAffineUrl(url))
.catch(e => {
logger.error('failed to handle affine url', e);
});
}