-
Notifications
You must be signed in to change notification settings - Fork 4
fix: move window state into separate file #798
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extracts window management functionality from the main Electron process file into a dedicated module for better code organization and maintainability.
Key Changes:
- Created a new
mainWindow.ts
module containing all window-related operations and state management - Updated the main process to use the new window management functions instead of inline window handling
- Modified test files to accommodate changes in function signatures (synchronous to asynchronous)
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
main/src/mainWindow.ts |
New module containing comprehensive window management functionality with proper error handling and TypeScript interfaces |
main/src/main.ts |
Simplified by removing window creation logic and importing functions from the new mainWindow module |
main/src/auto-update.ts |
Updated function signature to make window creation asynchronous |
main/src/system-tray.ts |
Updated to use new window management functions from mainWindow module |
main/src/toolhive-manager.ts |
Removed debug logging statement |
main/src/tests/auto-update.test.ts |
Updated test mocks to handle asynchronous window creation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it locally on Linux and it at least does not seem to break anything
Refactor: Extract Window Management to Dedicated Module
Changes Made
main-window.ts
module: Extracted all window management logic frommain.ts
into a dedicated, well-structured moduleBenefits
Files Modified
main/src/main-window.ts
- Complete window management module with 15+ exported functionsmain/src/main.ts
- Simplified by removing window management code and importing from new modulemain/src/auto-update.ts
- Updated to use new window management functionsmain/src/system-tray.ts
- Updated to use centralized window functionsmain/src/toolhive-manager.ts
- Updated imports and function calls