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

Stop writing optional theme fields #13702

Merged
1 commit merged into from
Aug 10, 2022
Merged

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 9, 2022

Other settings model classes call JsonUtils::SetValueForKey with the
private _##value member as the value. Since _##value is an optional,
this prevented writing out unset, optional fields. The new Themes class
deviated from this and this commit brings it back in line with the others.

Closes #13544

Validation Steps Performed

  • Create a { "name": "test" } theme
  • Save settings via the UI
  • Optional/Defaulted fields aren't written ✅

@ghost ghost added Area-Theming Anything related to the theming of elements of the window Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree. labels Aug 9, 2022
Comment on lines +37 to +38
#define THEME_SETTINGS_TO_JSON(type, name, jsonKey, ...) \
JsonUtils::SetValueForKey(json, jsonKey, _##name);
Copy link
Member Author

@lhecker lhecker Aug 9, 2022

Choose a reason for hiding this comment

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

Primary fix. Fixes most fields from appearing (like useMica).

Comment on lines -225 to -228
Theme::Theme() noexcept :
Theme{ winrt::WUX::ElementTheme::Default }
{
}
Copy link
Member Author

@lhecker lhecker Aug 9, 2022

Choose a reason for hiding this comment

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

Secondary fix. Prevents window.applicationTheme from appearing.
Note how this calls the other constructor which sets the _Window field.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

Thanks for digging into this!

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

thanks for fixing all my bugs 😄

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 10, 2022
@ghost
Copy link

ghost commented Aug 10, 2022

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit a161307 into main Aug 10, 2022
@ghost ghost deleted the dev/lhecker/13544-theme-optionals branch August 10, 2022 20:09
@ghost
Copy link

ghost commented Sep 13, 2022

🎉Windows Terminal Preview v1.16.252 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Theming Anything related to the theming of elements of the window AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. Severity-Blocking We won't ship a release like this! No-siree.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Writing settings includes all of Theme's optional keys
3 participants