Skip to content

Commit

Permalink
fix: ORV2-1788 Permit List sorting - state corrections (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnan-aot authored Dec 28, 2023
1 parent d912d60 commit d431f31
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ export const BasePermitList = ({
pageSize: 10,
});
const [globalFilter, setGlobalFilter] = useState<string>("");
const [sorting, setSorting] = useState<MRT_SortingState>([]);
const [sorting, setSorting] = useState<MRT_SortingState>([
{
id: "startDate",
desc: true,
},
]);

const permitsQuery = useQuery({
queryKey: [
Expand Down Expand Up @@ -74,7 +79,7 @@ export const BasePermitList = ({
retry: 1,
});

const { data, isError, isLoading } = permitsQuery;
const { data, isError, isLoading, isRefetching } = permitsQuery;

const table = useMaterialReactTable({
...defaultTableOptions,
Expand All @@ -83,16 +88,16 @@ export const BasePermitList = ({
enableRowSelection: false,
initialState: {
...defaultTableInitialStateOptions,
sorting: [{ id: "permitData.startDate", desc: true }],
sorting: [{ id: "startDate", desc: true }],
},
state: {
...defaultTableStateOptions,
showAlertBanner: isError,
showProgressBars: isLoading,
columnVisibility: { applicationId: true },
isLoading: isLoading,
isLoading: isLoading || isRefetching,
pagination,
globalFilter,
sorting,
},
renderTopToolbar: useCallback(
({ table }: { table: MRT_TableInstance<Permit> }) => (
Expand Down

0 comments on commit d431f31

Please sign in to comment.