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

ensure window state is tracked when settings dialog is open #354

Merged

Conversation

cristianoventura
Copy link
Collaborator

Description

The window state is not being persisted when the Settings dialog is open and, you move or resize the main window. This PR makes changes to the saveSettings function to ensure only fields that are being submitted from the form are being overwritten.

How to Test

  • Launch the app
  • Open the Settings dialog
  • Move and resize the main window
  • Make any other change on the settings dialog,such as changing the proxy port or changing the theme
  • Submit your changes
  • Close the app and check that window state and remaining settings were properly persisted

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)

@cristianoventura cristianoventura self-assigned this Nov 15, 2024
@cristianoventura cristianoventura requested a review from a team as a code owner November 15, 2024 18:43
@cristianoventura cristianoventura requested review from going-confetti and Llandy3d and removed request for a team November 15, 2024 18:43
Comment on lines +585 to +587
// don't pass fields that are not submitted by the form
const { windowState: _, ...settings } = data
const modifiedSettings = await saveSettings(settings)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The main issue is the data being submitted from the form contains the previous value for windowState and the one one file gets overwritten by the one submitted by the form.

Llandy3d
Llandy3d previously approved these changes Nov 15, 2024
Copy link
Member

@Llandy3d Llandy3d left a comment

Choose a reason for hiding this comment

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

🙌

Base automatically changed from fix/prevent-app-crash-when-settings-invalid to main November 15, 2024 19:29
@cristianoventura cristianoventura dismissed Llandy3d’s stale review November 15, 2024 19:29

The base branch was changed.

@cristianoventura cristianoventura merged commit 5197a22 into main Nov 15, 2024
2 checks passed
@cristianoventura cristianoventura deleted the fix/persist-window-state-when-settings-dialog-opened branch November 15, 2024 20:55
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