Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update is-browser.ts to account undefined navigator #1868

Merged
merged 2 commits into from
May 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/is-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Is the process an electron application
// check if we are in electron `renderer`
const electronRenderCheck =
(typeof navigator !== "undefined") &&

Check failure on line 7 in src/lib/is-browser.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `······(typeof·navigator·!==·"undefined")` with `↹↹↹typeof·navigator·!==·'undefined'`
navigator?.userAgent?.toLowerCase().indexOf(' electron/') > -1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
navigator?.userAgent?.toLowerCase().indexOf(' electron/') > -1
navigator.userAgent?.toLowerCase().indexOf(' electron/') > -1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertsLando I've run npm run lint-fix and made the above changes #1868

Additionally, this has been npm run builded, npm packed, and then npm installed to my local electron 30 project and looks like it's working.

if (electronRenderCheck && process?.versions) {
const electronMainCheck = Object.prototype.hasOwnProperty.call(
Expand Down
Loading