File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,19 @@ const InstanceStore = Reflux.createStore({
2121 listenables : InstanceActions ,
2222
2323 onActivated ( appRegistry ) {
24- appRegistry . on ( 'data-service-connected' , ( err , dataService ) => {
25- if ( ! err ) {
26- this . dataService = dataService ;
27- }
28- } ) ;
24+ appRegistry . on ( 'data-service-connected' , this . onConnected . bind ( this ) ) ;
25+ appRegistry . on ( 'data-service-disconnected' , this . onDisconnected . bind ( this ) ) ;
26+ } ,
27+
28+ onConnected ( err , dataService ) {
29+ if ( ! err ) {
30+ this . dataService = dataService ;
31+ }
32+ } ,
33+
34+ onDisconnected ( ) {
35+ const MongoDBInstance = require ( '../../../../app/models/mongodb-instance' ) ;
36+ app . state . instance = new MongoDBInstance ( ) ;
2937 } ,
3038
3139 /**
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ const SidebarStore = Reflux.createStore({
2828 appRegistry . getStore ( 'App.InstanceStore' ) . listen ( this . onInstanceChange . bind ( this ) ) ;
2929 appRegistry . on ( 'collection-changed' , this . onCollectionChanged . bind ( this ) ) ;
3030 appRegistry . on ( 'database-changed' , this . onDatabaseChanged . bind ( this ) ) ;
31+ appRegistry . on ( 'data-service-disconnected' , this . onDisconnected . bind ( this ) ) ;
3132 } ,
3233
3334 onCollectionChanged ( ns ) {
@@ -42,6 +43,10 @@ const SidebarStore = Reflux.createStore({
4243 } ) ;
4344 } ,
4445
46+ onDisconnected ( ) {
47+ this . setState ( this . getInitialState ( ) ) ;
48+ } ,
49+
4550 /**
4651 * Initialize the Compass Sidebar store state.
4752 *
You can’t perform that action at this time.
0 commit comments