feat(filters): save worklist query filters to session storage so that they persist between navigation to the viewer and back (#3749)

Co-authored-by: ladeirarodolfo <39910206+ladeirarodolfo@users.noreply.github.com>
This commit is contained in:
Joe Boccanfusoandladeirarodolfo authored and GitHub committed 2023-10-30 10:47:43 -04:00
1 parent db395852b6
commit 2a15ef0e44
13 files changed
+322 -9

No files matched your search

+13 -1
View File
@@ -26,6 +26,7 @@ import {
AboutModal,
UserPreferences,
LoadingIndicatorProgress,
useSessionStorage,
} from '@ohif/ui';
import i18n from '@ohif/i18n';
@@ -60,9 +61,17 @@ function WorkList({
const navigate = useNavigate();
const STUDIES_LIMIT = 101;
const queryFilterValues = _getQueryFilterValues(searchParams);
const [sessionQueryFilterValues, updateSessionQueryFilterValues] = useSessionStorage({
key: 'queryFilterValues',
defaultValue: queryFilterValues,
// ToDo: useSessionStorage currently uses an unload listener to clear the filters from session storage
// so on systems that do not support unload events a user will NOT be able to alter any existing filter
// in the URL, load the page and have it apply.
clearOnUnload: true,
});
const [filterValues, _setFilterValues] = useState({
...defaultFilterValues,
...queryFilterValues,
...sessionQueryFilterValues,
});
const debouncedFilterValues = useDebounce(filterValues, 200);
@@ -119,6 +128,7 @@ function WorkList({
val.pageNumber = 1;
}
_setFilterValues(val);
updateSessionQueryFilterValues(val);
setExpandedRows([]);
};
@@ -251,6 +261,7 @@ function WorkList({
moment(time, ['HH', 'HHmm', 'HHmmss', 'HHmmss.SSS']).format('hh:mm A');
return {
dataCY: `studyRow-${studyInstanceUid}`,
row: [
{
key: 'patientName',
@@ -377,6 +388,7 @@ function WorkList({
disabled={!isValidMode}
endIcon={<Icon name="launch-arrow" />} // launch-arrow | launch-info
onClick={() => {}}
data-cy={`mode-${mode.routeName}-${studyInstanceUid}`}
>
{t(`Modes:${mode.displayName}`)}
</LegacyButton>