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

TouchBarSegmentedControl - mutating segments leaves previous icon or label #17322

Closed
MarcusNoble opened this issue Mar 10, 2019 · 3 comments
Closed
Assignees

Comments

@MarcusNoble
Copy link

  • Electron Version:
    • 4.0.9
  • Operating System:
    • macOS 10.13.6
  • Last Known Working Electron version::
    • N/A

Expected Behavior

When replacing the segments array of a TouchBarSegmentedControl I expect the control to be completely replaced with the new values specified.

Actual Behavior

When a TouchBarSegmentedControl is created with a control that just has an icon and the segments are replaced with one that just has a label both the initial icon and the new label are show. The same happens when going from label to icon.

To Reproduce

Repo example: https://github.com/MarcusNoble/electron-TouchBarSegmentedControl-bug/blob/42a5b8f0226b80a4900f21bc69d21cf25dcd4df7/main.js#L49-L67

$ git clone https://github.com/MarcusNoble/electron-TouchBarSegmentedControl-bug.git
$ npm install
$ npm start

Screenshots

  1. Start with a control that just has an icon:
    image

  2. Replace the control with one that just has a label. The icon remains (even if set to undefined or null):
    image

  3. Replace again with one that has a different icon. The label remains.
    image

@welcome
Copy link

welcome bot commented Mar 10, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@MarshallOfSound
Copy link
Member

@MarcusNoble Relatively straight forward fix --> #17323

We weren't accounting for this case (where segments gets replaced with a non-similar structure of segment)

@MarcusNoble
Copy link
Author

Wow! That was fast! Thank you!

FYI: It's how VS Code does it as they pre-build several segmented groups to re-use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants