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: disable window reloading in prod build #275

Merged
merged 3 commits into from
Oct 25, 2024

Conversation

cristianoventura
Copy link
Collaborator

Description

This PR removes some properties from the application menu as long as their key bindings, including:

  • Reload: CMD + R
  • Force reload: CMD + Shift + R
  • Toggle developer tools: CMD + Option + I

How to Test

  • change the NODE_ENV variable in your localhost and check that CMD + R and other shortcuts mentioned above no longer work
  • check that the "app menu" is not present on a Windows build

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (npm run lint) and all checks pass.
  • I have run tests locally (npm test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

Related PR(s)/Issue(s)

Resolves #274

@cristianoventura cristianoventura self-assigned this Oct 24, 2024
@cristianoventura cristianoventura requested a review from a team as a code owner October 24, 2024 20:30
@cristianoventura cristianoventura requested review from going-confetti, e-fisher and allansson and removed request for a team October 24, 2024 20:30

function getDevToolsMenu(): Electron.MenuItemConstructorOptions[] {
return isDevEnv
? [{ role: 'reload' }, { role: 'forceReload' }, { role: 'toggleDevTools' }]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shortcuts are bound with the application menu. Here, we can conditionally remove them from prod mode.

@cristianoventura cristianoventura changed the title fix: disable window reloadin in prod build fix: disable window reloading in prod build Oct 24, 2024
e-fisher
e-fisher previously approved these changes Oct 25, 2024
Copy link
Collaborator

@e-fisher e-fisher left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

src/menu.ts Outdated Show resolved Hide resolved
Co-authored-by: Edgar Fisher <fisher.edgar@gmail.com>
@cristianoventura cristianoventura merged commit 546cce4 into main Oct 25, 2024
2 checks passed
@cristianoventura cristianoventura deleted the fix/window-reload-in-prod branch October 25, 2024 13:09
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.

Remove window reload from prod build
2 participants