-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Hide profiles by default if they aren't new #10910
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.
Ok! It took me a while to understand it but I think I get it now. So it'll work something like this:
- settings.json has profiles A, B, C, D (D = dynamic profile)
GeneratedProfiles
: A,B,C,D
- user removes D and saves
GeneratedProfiles
: A,B,C- D is loaded, but it's marked as hidden
_AppendDynamicProfilesToUserSettings
- D is hidden, so we don't append it to the JSON
Right?
- D is hidden, so we don't append it to the JSON
Either way, you showed me that it works earlier, and it looks great!
@@ -746,7 +785,7 @@ bool CascadiaSettings::_AppendDynamicProfilesToUserSettings() | |||
for (const auto& profile : _allProfiles) | |||
{ | |||
// Skip profiles that are in the user settings or the default settings. | |||
if (isInJsonObj(profile, _userSettings) || isInJsonObj(profile, _defaultSettings)) | |||
if (profile.Hidden() || isInJsonObj(profile, _userSettings) || isInJsonObj(profile, _defaultSettings)) |
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.
So technically this is the same as if (profile.Hidden() || profile.Origin() == OriginTag::User)
right? Just doesn't make sense to change it because it'll probably have some kind of unintended consequence.
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.
Yeah this is just there, because it would be confusing otherwise, if the profile you deleted suddenly shows up again. It felt weird, when I tested it. 😅
If someone is trying to delete that profile, wouldn't using |
After the literally 100 issues that have been filed on us for "i deleted the thing why does it come back", I'm gonna say no. Most folks don't know how dynamic profiles work, and they honsetly don't care. They just want to delete the thing and have it go away. |
Allowing users to delete individual profiles from a generator solves the case where they only want to delete one WSL profile--not all of them--because they've made a custom version of one that they want to detach from it. Disabling an entire generator is "the nuclear option." 😄
Reading the code review, it looks like one of the intermediate nodes is marked as hidden... so we will never write a new entry for a deleted-then-hidden profile to the JSON. This is awesome. |
Due to GitHub being somewhat down, I cannot review using the web UI. However: + for (auto profile : resultPtr->_allProfiles)
+ {
+ if (generatedProfiles.emplace(profile.Guid()).second)
+ {
+ generatedProfilesChanged = true; This is going to add user-origin profiles to the list, is is not? We'll eventually have a list of all profiles ever seen, rather than a list of profiles that were generated by a profile generator. Is this a worthwhile concern? + // In case that a user removed all of their profiles, we want to default to pretend as if
+ // the user asked for a "reset" of the profile list and readd all profiles as visible.
+ if (hiddenProfiles == resultPtr->_allProfiles.Size())
+ {
+ for (auto profile : resultPtr->_allProfiles)
+ {
+ profile.Hidden(false); We can remove the validation step in // Skip profiles that are in the user settings or the default settings.
- if (isInJsonObj(profile, _userSettings) || isInJsonObj(profile, _defaultSettings))
+ if (profile.Hidden() || isInJsonObj(profile, _userSettings) || isInJsonObj(profile, _defaultSettings)) This comment could use some updating! |
@DHowett Regarding your diffs in the order you wrote them:
|
@msftbot make sure @zadjii-msft signs off |
Hello @DHowett! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
Okay, so confirming the settings UI experience:
We should file a followup (does somebody want to own it for the 1.11 cycle?) for making the settings UI do the "right" thing here. |
What are "these" profiles? Custom or generated ones? Because I believe the former is unaffected by this change. The hidden attribute is only set on non-User profiles after all... I've tried this PR and deleting profiles in the SUI works as expected I believe. |
Ah I mean Generated ones :) |
I think half of the problem here is we need an extensions page. I feel like the proper design should be something like this:
For now, I think this implementation is fine because it helps JSON-only users not see the profile. Thoughts? |
Yes, that's the proper design. However: what's going to happen today and how much do we need to fix for 1.11? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Yea I'm cool with this. We obviously have more stuff to work out in post, but we always did. This doesn't really make it that much worse.
The only real caution here is the scenario where WSL just fails to load entirely (cause it does that sometimes), then we fail to find the profile source, then we don't include it in the settings.json
when we reserialize. But actually, that was a problem before too. Yea this is better than before and we'll work out the kinks.
Let's say a user doesn't know that they need to write `"hidden": true` in order to prevent a profile from showing up (and a settings UI doesn't exist). Naturally they would open settings.json and try to remove the profile object. This section of code recognizes if a profile was seen before and marks it as `"hidden": true` by default and thus ensures the behavior the user expects: Profiles won't show up again after they've been removed from settings.json. ## References #8324 - Application State ## PR Checklist * [x] Closes #8270 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * settings.json/state.json are created if they don't exist ✔️ * Removing any profile from settings.json doesn't cause it to appear again ✔️ * Hitting save in SUI creates profiles with `"hidden": true` ✔️ * Removing a default profile and hitting save in SUI works ❌ An empty object is added instead.
🎉 Handy links: |
Let's say a user doesn't know that they need to write
"hidden": true
inorder to prevent a profile from showing up (and a settings UI doesn't exist).
Naturally they would open settings.json and try to remove the profile object.
This section of code recognizes if a profile was seen before and marks it as
"hidden": true
by default and thus ensures the behavior the user expects:Profiles won't show up again after they've been removed from settings.json.
References
#8324 - Application State
PR Checklist
Validation Steps Performed
"hidden": true
✔️An empty object is added instead.