Commit 9112b2e9 authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

Fix initial filter usage for accession list page

parent e18b6892
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
// hook
import useAccessionPageLoad from 'accession/hook/useAccessionPageLoad';
......@@ -7,6 +8,7 @@ import useAccessionPageLoad from 'accession/hook/useAccessionPageLoad';
import PageTitle from 'ui/common/PageTitle';
import AccessionTable from 'accession/c/AccessionTable';
import { AccessionFilters } from 'accession/AccessionFilters';
// util
import { LocalStorageCart } from 'utilities';
import { parseLocationSearch } from 'utilities/filterUtil';
......@@ -20,9 +22,11 @@ const AccessionListPage = ({location}: AccessionListPageProps) => {
const { t } = useTranslation()
// memo
const initialFilterCode = React.useMemo(() => parseLocationSearch(location).filterCode, [location]);
// redux
const initialFilter = useSelector((state: any) => state?.appConfig?.config?.filter)
// custom
const { accessions, filter, applyFilter, loadData } = useAccessionPageLoad({initialFilterCode});
const { accessions, filter, applyFilter, loadData } = useAccessionPageLoad({initialFilterCode, initialFilter});
// state
const [selectedAccessions, setSelectedAccessions] = React.useState<string[]>([]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment