@@ -223,16 +223,21 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
223223 this . _loadingResourcesBtn . setVisibility ( "visible" ) ;
224224 this . __getNextStudiesRequest ( )
225225 . then ( resp => {
226- if (
227- "workspaceId" in resp [ "params" ] [ "url" ] &&
228- (
229- resp [ "params" ] [ "url" ] . workspaceId !== this . getCurrentWorkspaceId ( ) ||
230- resp [ "params" ] [ "url" ] . folderId !== this . getCurrentFolderId ( )
231- )
232- ) {
233- // Context might have been changed while waiting for the response.
234- // The new call is on the ways and this can be ignored.
235- return ;
226+ const urlParams = resp [ "params" ] [ "url" ] ;
227+ // Context might have been changed while waiting for the response.
228+ // The new call is on the way, therefore this response can be ignored.
229+ if ( "workspaceId" in urlParams ) {
230+ if (
231+ urlParams . workspaceId !== this . getCurrentWorkspaceId ( ) ||
232+ urlParams . folderId !== this . getCurrentFolderId ( )
233+ ) {
234+ return ;
235+ }
236+ } else if ( "text" in urlParams ) {
237+ const currentFilterData = this . _searchBarFilter . getFilterData ( ) ;
238+ if ( currentFilterData . text && urlParams . text !== encodeURIComponent ( currentFilterData . text ) ) {
239+ return ;
240+ }
236241 }
237242
238243 const studies = resp [ "data" ] ;
@@ -645,17 +650,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
645650 const filterData = this . _searchBarFilter . getFilterData ( ) ;
646651 if ( filterData . text ) {
647652 params . url . text = encodeURIComponent ( filterData . text ) ; // name, description and uuid
648- } else {
649- params . url . workspaceId = this . getCurrentWorkspaceId ( ) ;
650- params . url . folderId = this . getCurrentFolderId ( ) ;
651- }
652-
653- if ( params . url . text ) {
654- delete params . url . orderBy ;
655653 return osparc . data . Resources . fetch ( "studies" , "getPageSearch" , params , undefined , options ) ;
656- } else if ( params . url . orderBy ) {
657- return osparc . data . Resources . fetch ( "studies" , "getPageSortBy" , params , undefined , options ) ;
658654 }
655+
656+ params . url . workspaceId = this . getCurrentWorkspaceId ( ) ;
657+ params . url . folderId = this . getCurrentFolderId ( ) ;
659658 return osparc . data . Resources . fetch ( "studies" , "getPage" , params , undefined , options ) ;
660659 } ,
661660
0 commit comments