diff --git a/platform/viewer/src/routes/WorkList/WorkList.jsx b/platform/viewer/src/routes/WorkList/WorkList.jsx index d42f775d5..14484b10f 100644 --- a/platform/viewer/src/routes/WorkList/WorkList.jsx +++ b/platform/viewer/src/routes/WorkList/WorkList.jsx @@ -45,6 +45,12 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { const debouncedFilterValues = useDebounce(filterValues, 200); const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues; + /* + * The default sort value keep the filters synchronized with runtime conditional sorting + * Only applied if no other sorting is specified and there are less than 101 studies + */ + let defaultSortValues = {}; + const sortedStudies = studies // TOOD: Move sort to DataSourceWrapper? // TODO: MOTIVATION, this is triggered on every render, even if list/sort does not change @@ -54,7 +60,10 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { if (noSortApplied && studies.length < 101) { const ascendingSortModifier = -1; - + defaultSortValues = { + sortBy: 'studyDate', + sortDirection: 'ascending', + }; return _sortStringDates(s1, s2, ascendingSortModifier); } else if (noSortApplied) { return 0; @@ -216,8 +225,8 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { content: patientName ? ( {patientName} ) : ( - (Empty) - ), + (Empty) + ), gridCol: 4, }, { @@ -281,13 +290,13 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { seriesTableDataSource={ seriesInStudiesMap.has(studyInstanceUid) ? seriesInStudiesMap.get(studyInstanceUid).map(s => { - return { - description: s.description || '(empty)', - seriesNumber: s.seriesNumber || '', - modality: s.modality || '', - instances: s.numSeriesInstances || '', - }; - }) + return { + description: s.description || '(empty)', + seriesNumber: s.seriesNumber || '', + modality: s.modality || '', + instances: s.numSeriesInstances || '', + }; + }) : [] } > @@ -304,7 +313,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { @@ -353,7 +362,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { setFilterValues(defaultFilterValues)} isFiltering={isFiltering(filterValues, defaultFilterValues)} @@ -376,10 +385,10 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { /> ) : ( -
- -
- )} +
+ +
+ )} ); }