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

Fp 2644: UI is frozen in certain split configurations in the ide #371

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

quirinpa
Copy link
Contributor

@quirinpa quirinpa commented Nov 12, 2024

  • FP-2644: UI is frozen in certain split configurations in the IDE

@quirinpa quirinpa self-assigned this Nov 12, 2024
@quirinpa quirinpa requested a review from a team as a code owner November 12, 2024 10:24
Copy link
Contributor

@manuelnogueiramov manuelnogueiramov left a comment

Choose a reason for hiding this comment

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

The logic here is going to cause some regressions later.

tabExists = _layout.dockbox.children[0].tabs.find(
(t) => t.id === layoutActiveId,
);
if (_layout.dockbox.children[0].tabs)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect. It completly alters the logic here.
First we were checking if the tab existed in the maxbox (maximized), if it didn't, then we went look for it in the dockbox.

The way you did it we'll always overwrite tabExists even if it exists in the maxbox.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It only alters the logic in the sense that it doesn't bug out if that object "tabs" is does not have a "find" method.

So I think you are incorrect about your pointing out of non-correctness.

It does not alter the logic at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, it seemed like you replaced the previous if with the new one. But apparently you just added a new one inside it.

Good call 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Only suggestion here would be to do:

const dockboxChildren = _layout.dockbox.children[0].tabs;

And use it in both places.

Copy link
Contributor

@manuelnogueiramov manuelnogueiramov left a comment

Choose a reason for hiding this comment

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

You were correct, I misread the code. Still left a simple suggestion, but it's not blocking. Good job 👍

tabExists = _layout.dockbox.children[0].tabs.find(
(t) => t.id === layoutActiveId,
);
if (_layout.dockbox.children[0].tabs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, it seemed like you replaced the previous if with the new one. But apparently you just added a new one inside it.

Good call 👍

tabExists = _layout.dockbox.children[0].tabs.find(
(t) => t.id === layoutActiveId,
);
if (_layout.dockbox.children[0].tabs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Only suggestion here would be to do:

const dockboxChildren = _layout.dockbox.children[0].tabs;

And use it in both places.

@quirinpa
Copy link
Contributor Author

Since I have to update the branch anyway, I would like to integrate your suggestion.

Thank you @manuelnogueiramov for checking this out.

@manuelnogueiramov
Copy link
Contributor

The new code looks weird... where are we checking for the dockbox children now?

Copy link
Contributor

@manuelnogueiramov manuelnogueiramov left a comment

Choose a reason for hiding this comment

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

The current code will introduce regressions.

@diasnad diasnad self-requested a review November 26, 2024 19:51
@quirinpa
Copy link
Contributor Author

quirinpa commented Dec 6, 2024

You are incorrect, Manuel. The variable you suggested was already defined.
Please take a look at the entire context.

Comment on lines 140 to 146
let tabExists = maxboxChildren?.tabs.find((t) => t.id === layoutActiveId);

if (!tabExists) {
tabExists = _layout.dockbox.children[0].tabs.find(
(t) => t.id === layoutActiveId,
);
if (maxboxChildren?.tabs)
tabExists = maxboxChildren.tabs.find((t) => t.id === layoutActiveId);
}
activeTabId.current = layoutActiveId;
Copy link
Contributor

Choose a reason for hiding this comment

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

I looked at this for some time, and this makes 0 sense. We're NEVER checking dockbox anymore for the tab. The first approach you did, seemed to work correctly. This is just nonsense. line 144 that you introduced is exactly the same as line 140. Where it used to be a check inside dockbox, not maxbox again.

Copy link
Contributor Author

@quirinpa quirinpa Dec 11, 2024

Choose a reason for hiding this comment

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

Ok. In this case you seem correct. I'll be back on this shortly, to test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Testing it, it just works. Maybe that's due to the fact that the maxbox and the dockbox children are the same.
Do you have any reason to think of a situation where they aren't?

Copy link
Contributor

Choose a reason for hiding this comment

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

Testing what? Did you test every possible scenario? If you did and nothing broke, we're good to go. As I doubt that happened, my request changes still mantains. I know I added that a few years ago because of an edge case scenario. Approving this code as is will fix YOUR issue and cause at least 1 regression.
Before you ask, I don't remember what, but if you dig a bit you'll find the ticket that first originated that code and then you can test it.

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

Successfully merging this pull request may close these issues.

3 participants