title_bar: Fix `ToggleProjects` panic (#48775)

Finn Evers created

Another follow-up to the multi workspace PR

- [X] Code Reviewed
- [X] Manual QA

Release Notes:

- N/A

Change summary

crates/title_bar/src/title_bar.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

crates/title_bar/src/title_bar.rs 🔗

@@ -84,8 +84,10 @@ pub fn init(cx: &mut App) {
                 .titlebar_item()
                 .and_then(|item| item.downcast::<TitleBar>().ok())
             {
-                titlebar.update(cx, |titlebar, cx| {
-                    titlebar.show_project_dropdown(window, cx);
+                window.defer(cx, move |window, cx| {
+                    titlebar.update(cx, |titlebar, cx| {
+                        titlebar.show_project_dropdown(window, cx);
+                    })
                 });
             }
         });