-
Notifications
You must be signed in to change notification settings - Fork 19.8k
fix: theme-switch-keep-data. close apache#21200 #21201
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
Open
mustcanbedo
wants to merge
6
commits into
apache:master
Choose a base branch
from
mustcanbedo:fix-theme-switch-keep-data
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+105
−5
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8575bb1
fix: theme-switch-keep-data. close apache##21200
mustcanbedo 6c4ba79
fix: getOption does not exist
mustcanbedo 2565079
fix: Change the thought process
mustcanbedo ebd26ff
Merge branch 'fix-theme-switch-keep-data' of https://github.com/mustc…
mustcanbedo f72bb3f
fix: Restore the original code
mustcanbedo 03e13c2
fix: Scene issue
mustcanbedo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
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.
The format of the
theme objectis different from theoption, and currently all of the theme are applied byComponent#mergeDefaultAndTheme, therefore,theme objectshould not be the input ofthis._mergeOption.From my understanding, under the current definition, the implementation of this feature (keep the previous changes when
setTheme) is unfeasible.The current definition is:
themeacts as "default values", andoptioncan override properties specified in atheme, but not vice versa.Suppose we simply merge a new theme to the current model, some bad cases probably arise, for example:
theme1bysetThemeoption1bysetOptiontheme2bysetThemeoption2bysetOptionSome properties specified by
option1may be overridden bytheme2, which is unexpected.Once we introduce that bad cases, they are unable to be fixed and cause the behavior unpredictable and error-prone.
If implement this feature by saving all of the inputs to the API (
setOption,dispatchAction, etc.), and restore them when callingsetTheme, that might be logically correct, but may significantly degrade performance, and cause memory leak in scenarios thatsetOptionis called repeatedly over time.I'm not quite sure the real-world scenarios that requires "
setThemewhile keeping data". Is there any alternative way to achieve that?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.