Fix deep link opening when window is closed#1633
Conversation
|
.bundle |
michaelneale
left a comment
There was a problem hiding this comment.
conditionally approved - @matthewdiamant were you able to test it by building into .app - as I think deep links only work when packaged (in any case - a bundle should be available here shortly).
| let firstOpenWindow: BrowserWindow; | ||
| let pendingDeepLink = null; // Store deep link if sent before React is ready | ||
| app.on('open-url', async (event, url) => { | ||
| event.preventDefault(); |
There was a problem hiding this comment.
it is ok to remove this? (actually never sure why it was there in the first place)
There was a problem hiding this comment.
I was able to test deep links without packaging the app, just the regular npm start dev mode environment.
There was a problem hiding this comment.
OH WOW - @matthewdiamant I wish I had known this months ago!
macOS ARM64 Desktop App (Apple Silicon)📱 Download macOS Desktop App (arm64, signed) Instructions: This link is provided by nightly.link and will work even if you're not logged into GitHub. |
Fixes #1534
When clicking a deep link, sometimes the window is closed. We open up a new window, and then wait until that window has loaded to send a message to the renderer to open an extension link.
The issue is that even though the window has loaded, React has not loaded, so it misses this message.
Instead, we need React to tell the main process that it is ready. So, create a
reactReadycall that does this. This might be useful later on for other needs as well (deep link or otherwise).Then, when the main process gets a
react-readymessage, if there is apendingDeepLink, it sends the message to the renderer to open the extension link.