Skip to content

Fix external URL handler signature in main.dev.js#376

Open
hellosamyak wants to merge 1 commit intoStatTag:masterfrom
hellosamyak:fix/main-dev-handleurl-sync
Open

Fix external URL handler signature in main.dev.js#376
hellosamyak wants to merge 1 commit intoStatTag:masterfrom
hellosamyak:fix/main-dev-handleurl-sync

Conversation

@hellosamyak
Copy link
Copy Markdown
Contributor

Summary:
Remove accidental TypeScript annotation from JavaScript file and make URL handler synchronous for correct use in setWindowOpenHandler.

Why:
The previous function signature caused JS compile errors, and async returned a Promise where a boolean was expected.

File:
app/main.dev.js

@hellosamyak
Copy link
Copy Markdown
Contributor Author

@lrasmus could you please take a look at this small fix PR when you get a chance?

@lrasmus
Copy link
Copy Markdown
Contributor

lrasmus commented Mar 25, 2026

@hellosamyak - I am curious when you got the javascript compile error? I do not recall seeing that on my end. Did the function not work when you were testing it? I just want to understand exactly the steps to reproduce the problem so that I can make a note to similarly test in the future.

@hellosamyak
Copy link
Copy Markdown
Contributor Author

@lrasmus Hi Luke, thanks for asking.

I should clarify: I did not hit a webpack/electron build failure from this change while running yarn dev. The app still launched.
What I saw was an editor/type-check diagnostic in VS Code on [main.dev.js] at the function signature using url: string inside a .js file.
So the “compile error” wording from me was imprecise; it was a JS/TS language-service error in the Problems panel, not a runtime bundling crash.

Repro steps I used:

  1. Checkout the pre-fix code where handleUrl is declared as async function handleUrl(url: string) in main.dev.js.
  2. Open that file in VS Code with JavaScript validation enabled.
  3. Observe the Problems panel message: “Type annotations can only be used in TypeScript files.”

Runtime note:

  • In my smoke testing, the app still started.
  • But I changed the function to synchronous because it is used in a boolean condition in setWindowOpenHandler; async returns a Promise there, which is not ideal for that flow.

So the fix was mainly to remove editor/type-check noise and align the handler behavior with how it is consumed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants