workspace: Do not call set_active when deserializing a dock if that dock was not visible (#27852)

Piotr Osiewicz and Anthony Eid created

This unblocks work on new debugger UI, where we don't want the
set_active function to be called unconditionally.

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>

Change summary

crates/workspace/src/dock.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

crates/workspace/src/dock.rs 🔗

@@ -565,7 +565,7 @@ impl Dock {
 
     pub fn restore_state(&mut self, window: &mut Window, cx: &mut Context<Self>) -> bool {
         if let Some(serialized) = self.serialized_dock.clone() {
-            if let Some(active_panel) = serialized.active_panel {
+            if let Some(active_panel) = serialized.active_panel.filter(|_| serialized.visible) {
                 if let Some(idx) = self.panel_index_for_persistent_name(active_panel.as_str(), cx) {
                     self.activate_panel(idx, window, cx);
                 }