@@ -16,12 +16,12 @@ function handleShowWidget (store, next, action) {
1616 if ( action . data . type === 'TimeSeries' ) { // Instances.getInstance(path).getType().wrappedObj.name
1717 store . dispatch ( updateDetailsWidget ( action . data . instancePath ) ) ;
1818 return handlePlotTimeseries ( store , next , action ) ;
19- }
20- if ( action . data . type === 'ImageSeries' ) { // Instances.getInstance(path).getType().wrappedObj.name
19+ } else if ( action . data . type === 'ImageSeries' ) { // Instances.getInstance(path).getType().wrappedObj.name
2120 store . dispatch ( updateDetailsWidget ( action . data . instancePath ) ) ;
2221 return handleImportTimestamps ( store , next , action ) ;
22+ } else {
23+ return next ( action ) ;
2324 }
24- return next ( action ) ;
2525}
2626
2727function handleImportTimestamps ( store , next , action ) {
@@ -75,11 +75,13 @@ function handlePlotTimeseries (store, next, action) {
7575}
7676
7777const nwbMiddleware = store => next => action => {
78- next ( action ) ;
78+
7979 switch ( action . type ) {
8080
8181 case LOAD_NWB_FILE :
82+ next ( action ) ;
8283 Project . loadFromURL ( action . data . nwbFileUrl ) ;
84+
8385 GEPPETTO . on ( 'jupyter_geppetto_extension_ready' , data => { // It's triggered once
8486
8587 console . log ( "Initializing Python extension" ) ;
@@ -95,28 +97,33 @@ const nwbMiddleware = store => next => action => {
9597
9698
9799 case LOAD_NWB_FILE_IN_NOTEBOOK :
100+ next ( action ) ;
98101 nwbFileService . loadNWBFileInNotebook ( store . getState ( ) . nwbfile . nwbFileUrl ) . then (
99102 ( ) => store . dispatch ( loadedNWBFileInNotebook )
100103 ) ;
104+
101105 break ;
102106
103107 case UNLOAD_NWB_FILE_IN_NOTEBOOK :
108+ next ( action ) ;
104109 Utils . execPythonMessage ( 'del nwbfile' ) ;
110+
105111 break ;
106112
107113 case NOTEBOOK_READY :
114+ next ( action ) ;
108115 // FIXME for some reason the callback for python messages is not being always called
109116 Utils . execPythonMessage ( 'from nwb_explorer.nwb_main import main' ) ;
110117 store . dispatch ( loadNWBFileInNotebook ) ;
111-
118+
112119 break ;
113120
114121 case UPDATE_WIDGET :
115122 case ADD_WIDGET :
116- return handleShowWidget ( store , next , action ) ;
117-
118123 case ADD_PLOT_TO_EXISTING_WIDGET :
119- return handlePlotTimeseries ( store , next , action )
124+ return handleShowWidget ( store , next , action ) ;
125+
126+ default : next ( action ) ;
120127 }
121128
122129
0 commit comments