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

Include profile nav menu items to consider for retaining position #10618

Merged
merged 2 commits into from
Jul 12, 2021

Conversation

mimvdb
Copy link
Contributor

@mimvdb mimvdb commented Jul 11, 2021

Summary of the Pull Request

When discarding or saving settings, the current navigation should be retained.

References

Issue introduced by #10390

PR Checklist

Detailed Description of the Pull Request / Additional comments

menuItemsSTL is filled with all non profile navItems, then menuItemsSTL fills menuItems, then the profile navItems are added to menuItems. So to include the profile nav items in the iteration, menuItems needs to be used

Validation Steps Performed

Spam discard and save buttons

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.

This seems reasonable to me, but I think I want @carlos-zamora and @lhecker to sign off, since they're the owner and author of the original PR

@zadjii-msft
Copy link
Member

@msftbot make sure that @carlos-zamora and @lhecker sign off on this PR

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 12, 2021
@ghost
Copy link

ghost commented Jul 12, 2021

Hello @zadjii-msft!

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".

@zadjii-msft zadjii-msft added the Area-Settings UI Anything specific to the SUI label Jul 12, 2021
Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

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

There's another use of menuItems on line 174. Would you mind changing this to the following?

const auto& firstItem{ menuItemsSTL.at(0) };

(Completely optional of course.)

@mimvdb
Copy link
Contributor Author

mimvdb commented Jul 12, 2021

Would you mind changing this to the following?

No problem, that will work because the first item is never a profile.

There's another use

@lhecker Just to make sure we're on the same line: this PR changes menuItemsSTL to menuItems and not the other way around.

@ghost ghost removed the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 12, 2021
@lhecker
Copy link
Member

lhecker commented Jul 12, 2021

OOOOOOOH Now I got it. Damn that's embarrassing. 😄 I'm sorry.

It might make sense to change _InitializeProfilesList to not modify the menuItems list directly in the future to make this more obvious. It's faster anyways to bulk-read a COM vector into a STL container, modify the container and bulk-write it back into the COM vector.

@mimvdb
Copy link
Contributor Author

mimvdb commented Jul 12, 2021

Yes that might make sense. It might also be nicer to update instead of replace the profile navs where possible (ICONS FLICKER WHEN RELOADING). I tried that for a bit for #10609 but wasn't successful (I got some very weird behavior probably due to unfamiliarity with winrt/winui). When spamming save/discard I get 100% cpu split between menuItems.ReplaceAll and _InitializeProfilesList

@mimvdb
Copy link
Contributor Author

mimvdb commented Jul 12, 2021

I was typing in a hurry and my point got away from me. On my machine menuItems.ReplaceAll took longer than _InitializeProfilesList (though only slightly). So while

It's faster anyways to bulk-read a COM vector into a STL container, modify the container and bulk-write it back into the COM vector

is probably true all things being equal, it might still be faster to append on startup because most of the menu items are already loaded by the XAML.

I'll leave the PR like this (unless there are other comments of course)

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Love it! Thanks for doing this!

Regarding the _InitializeProfilesList discussion and the "icon flickering" issue, happy to take contributions for that too. If you want to do it, go for it. Otherwise, I'm down for you to open an issue so that we can track these code-health/performance things. Thanks!

@carlos-zamora carlos-zamora added the Product-Terminal The new Windows Terminal. label Jul 12, 2021
@lhecker lhecker added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 12, 2021
@ghost
Copy link

ghost commented Jul 12, 2021

Hello @lhecker!

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.

@carlos-zamora
Copy link
Member

@DHowett tagging these as both XXX-Service-Consider. I'm a bit confused as to which branch/release this change should target because of the new til::feature workflow, so sorry if you can't actually port this to both.

@carlos-zamora carlos-zamora added zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. labels Jul 12, 2021
@ghost ghost added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jul 12, 2021
@lhecker lhecker merged commit ef8ba20 into microsoft:main Jul 12, 2021
DHowett pushed a commit that referenced this pull request Jul 12, 2021
…0618)

## Summary of the Pull Request

When discarding or saving settings, the current navigation should be retained.

## References

Issue introduced by #10390

## PR Checklist

* [x] Closes #10617
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

## Detailed Description of the Pull Request / Additional comments

`menuItemsSTL` is filled with all _non_ profile navItems, then `menuItemsSTL` fills `menuItems`, then the profile navItems are added to `menuItems`. So to include the profile nav items in the iteration, `menuItems` needs to be used

## Validation Steps Performed

Spam discard and save buttons

(cherry picked from commit ef8ba20)
@ghost
Copy link

ghost commented Jul 14, 2021

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

Handy links:

@ghost
Copy link

ghost commented Jul 14, 2021

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

Handy links:

@DHowett DHowett removed zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. labels Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings UI Anything specific to the SUI 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. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settings UI: Current nav item is reset when discarding/saving on a profile nav item
5 participants