File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
invokeai/frontend/web/src/features/ui/layouts Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ describe('AppNavigationApi', () => {
127127
128128 describe ( 'Basic Connection' , ( ) => {
129129 it ( 'should connect to app' , ( ) => {
130+ expect ( navigationApi . $isConnected . get ( ) ) . toBe ( false ) ;
130131 navigationApi . connectToApp ( mockAppApi ) ;
131132
132133 expect ( navigationApi . _app ) . not . toBeNull ( ) ;
@@ -135,13 +136,15 @@ describe('AppNavigationApi', () => {
135136 expect ( navigationApi . _app ?. storage . set ) . toBe ( mockSetStorage ) ;
136137 expect ( navigationApi . _app ?. storage . get ) . toBe ( mockGetStorage ) ;
137138 expect ( navigationApi . _app ?. storage . delete ) . toBe ( mockDeleteStorage ) ;
139+ expect ( navigationApi . $isConnected . get ( ) ) . toBe ( true ) ;
138140 } ) ;
139141
140142 it ( 'should disconnect from app' , ( ) => {
141143 navigationApi . connectToApp ( mockAppApi ) ;
142144 navigationApi . disconnectFromApp ( ) ;
143145
144146 expect ( navigationApi . _app ) . toBeNull ( ) ;
147+ expect ( navigationApi . $isConnected . get ( ) ) . toBe ( false ) ;
145148 } ) ;
146149 } ) ;
147150
Original file line number Diff line number Diff line change @@ -112,20 +112,28 @@ export class NavigationApi {
112112 */
113113 _app : NavigationAppApi | null = null ;
114114
115+ /**
116+ * A flag indicating if the application is currently connected to the navigation API.
117+ */
118+ private _$isConnected = atom ( false ) ;
119+ $isConnected : Atom < boolean > = this . _$isConnected ;
120+
115121 /**
116122 * Connect to the application to manage tab switching.
117123 * @param api - The application API that provides methods to set and get the current app tab and manage panel
118124 * state storage.
119125 */
120126 connectToApp = ( api : NavigationAppApi ) : void => {
121127 this . _app = api ;
128+ this . _$isConnected . set ( true ) ;
122129 } ;
123130
124131 /**
125132 * Disconnect from the application, clearing the tab management functions.
126133 */
127134 disconnectFromApp = ( ) : void => {
128135 this . _app = null ;
136+ this . _$isConnected . set ( false ) ;
129137 } ;
130138
131139 /**
You can’t perform that action at this time.
0 commit comments