zen-browser / desktop

🌀 Experience tranquillity while browsing the web without people tracking you!
https://zen-browser.app
Mozilla Public License 2.0
18.92k stars 456 forks source link

Workspace change refactoring #3121

Closed kristijanribaric closed 15 hours ago

kristijanribaric commented 2 days ago

Fix: Handle essential tabs and container-specific essentials

Refactor workspace switching logic to correctly handle essential tabs and introduce container-specific essentials.

This change addresses issues with essential tabs not being handled correctly during workspace switches.

The changeWorkspace function is refactored to improve clarity and maintainability. The logic for showing and hiding tabs is streamlined, and tab selection is handled more robustly. A new _shouldShowTab function is introduced to centralize the logic for determining tab visibility based on workspace and container settings. The logic also handles pinned essential tabs in the different workspace types.

The pinned tab manager is updated to support container- specific essentials and to refresh pinned tabs on workspace changes. The _shouldShowPin function is introduced to manage visibility of pinned tabs in different workspaces considering essential tabs, pinned tabs and containers.

This change also fixes a bug where the selected tab would sometimes be changed unexpectedly when switching workspaces.

This PR also prevents creating new window for dragging pinned tab out of the window.