Repository navigation
Props: only save hop-config.json when a GUI property changes, fixes #9837 - #9882
Open
vbhanuchander-lang wants to merge 1 commit into
Open
vbhanuchander-lang wants to merge 1 commit into
vbhanuchander-lang wants to merge 1 commit into
Conversation
…pache#9837 Every Hop GUI start wrote the whole configuration file once for each default PropsUi sets, about ten times, nearly always with values that were already stored. Props.setProperty now skips the save when the value is unchanged. Props.containsKey looked for the key at the top level of the configuration, while setProperty stores GUI properties under their own section, so it never found one. Props.setDefault therefore rewrote WorkflowDialogStyle on every start, overwriting a stored value. It now looks where setProperty stores.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9837.
The data loss in #9837 (the rename deleting
hop-config.jsonfirst) is already fixed on main by #9800, which replaces the file atomically with retries. This PR handles the other part of the report: Hop GUI writes the whole file about ten times on every start, which gives a virus scanner or indexer that many chances to hold it open.Props.setPropertyskips the save when the value is already stored.PropsUi.setDefaultsets the fonts, icon size, line width and max undo on every start, nearly always to the values already there.Props.containsKeylooked at the top level of the configuration, whilesetPropertystores GUI properties in their own section, so it never found a key.Props.setDefaulttherefore rewroteWorkflowDialogStyleon every start, the key in the issue's stack trace, and overwrote any stored value. It now looks wheresetPropertystores.setDefaultis its only caller.New
PropsTest(core) counts saves with a stub serializer: an unchanged value is not saved,containsKeyfinds a stored GUI property, and a storedWorkflowDialogStyleis kept. All 3 fail without the change. The core*Props*/*Config*/*RegionalSettings*tests (38) pass, and checkstyle and spotless are clean.