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

Unreachable Code in tab-bars.ts #14977

Open
tsmaeder opened this issue Feb 19, 2025 · 4 comments
Open

Unreachable Code in tab-bars.ts #14977

tsmaeder opened this issue Feb 19, 2025 · 4 comments

Comments

@tsmaeder
Copy link
Contributor

Bug Description:

In tab-bars.ts#1233 there is unreachable code. The line reads:

 if ((newOverflowingTabs.length !== this.tabsOverflowData?.titles.length ?? 0) ||...

But probably should read

 if ((newOverflowingTabs.length !== (this.tabsOverflowData?.titles.length ?? 0)) ||...

I'm not recently familiar with the code, so not sure what the right fix is or whether this causes problems.

Additional Information

  • Operating System:
  • Theia Version:
@tsmaeder
Copy link
Contributor Author

@tortmayr do you know immediately what the right fix is?

@tortmayr
Copy link
Contributor

tortmayr commented Feb 19, 2025

Since there already is a null-check for this.tabOverflowData in tab-bars.ts#1226
the right fix is probably just:

         if ((newOverflowingTabs.length !== this.tabsOverflowData.titles.length) || ...

@tsmaeder
Copy link
Contributor Author

But that's not equivalent in the case where `newOverflowingTabs.length is 0 and this.tabsOverflowData is undefined.

@tortmayr
Copy link
Contributor

It is, since we never reach this part of the code if this.tabOverflowData is undefined anyways.
In this case we return early in tab-bars.ts#1229

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