File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -297,6 +297,7 @@ fn App() -> Element {
297297 }
298298
299299 let mut open_add_tunnel_from_tray = use_signal ( || false ) ;
300+ let mut login_state_for_tray = use_signal ( || None :: < lib:: datum_cloud:: LoginState > ) ;
300301
301302 // Create tray when app state is ready. Must run before early return.
302303 #[ cfg( feature = "desktop" ) ]
@@ -328,6 +329,11 @@ fn App() -> Element {
328329 window. set_visible ( false ) ;
329330 }
330331 "new_tunnel" => {
332+ if login_state_for_tray ( ) == Some ( lib:: datum_cloud:: LoginState :: Missing )
333+ || login_state_for_tray ( ) . is_none ( )
334+ {
335+ return ;
336+ }
331337 window. set_visible ( true ) ;
332338 window. set_focus ( ) ;
333339 open_add_tunnel_from_tray. set ( true ) ;
@@ -351,6 +357,11 @@ fn App() -> Element {
351357 provide_context ( auth_changed) ;
352358
353359 let state_for_auth_watch = consume_context :: < AppState > ( ) ;
360+ use_effect ( move || {
361+ let _ = auth_changed ( ) ;
362+ let state = consume_context :: < AppState > ( ) ;
363+ login_state_for_tray. set ( Some ( state. datum ( ) . login_state ( ) ) ) ;
364+ } ) ;
354365 use_future ( move || {
355366 let state_for_auth_watch = state_for_auth_watch. clone ( ) ;
356367 let mut auth_changed = auth_changed;
You can’t perform that action at this time.
0 commit comments