Skip to content

Commit

Permalink
Enable sorting for file util search results (ShokoAnime#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmohan authored Feb 14, 2024
1 parent 64f4ca5 commit ce28270
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/components/Utilities/UtilitiesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Props = {
isFetchingNextPage: boolean;
rows: FileType[] | SeriesType[];
setSortCriteria?: React.Dispatch<React.SetStateAction<FileSortCriteriaEnum>>;
skipSort: boolean;
skipSort?: boolean;
sortCriteria?: FileSortCriteriaEnum;
handleRowSelect?: (id: number, select: boolean) => void;
rowSelection?: Record<number, boolean>;
Expand Down Expand Up @@ -139,7 +139,7 @@ const HeaderItem = (
id: string;
name: string;
setSortCriteria?: React.Dispatch<React.SetStateAction<FileSortCriteriaEnum>>;
skipSort: boolean;
skipSort?: boolean;
sortCriteria?: FileSortCriteriaEnum;
},
) => {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/utilities/FileSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ const FileSearch = () => {
const debouncedSearch = useDebounce(search, 250);
const filesQuery = useFilesInfiniteQuery({
include: ['XRefs'],
sortOrder: debouncedSearch ? [] : [sortCriteria],
sortOrder: [sortCriteria],
pageSize: 50,
}, debouncedSearch);
const [files, fileCount] = useFlattenListResult<FileType>(filesQuery.data);
Expand Down Expand Up @@ -338,7 +338,6 @@ const FileSearch = () => {
rows={files}
rowSelection={rowSelection}
setSelectedRows={setRowSelection}
skipSort={!!debouncedSearch}
setSortCriteria={setSortCriteria}
sortCriteria={sortCriteria}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ function IgnoredFilesTab() {
{
pageSize: 50,
include_only: ['Ignored'],
sortOrder: debouncedSearch
? []
: [sortCriteria, FileSortCriteriaEnum.FileName, FileSortCriteriaEnum.RelativePath],
sortOrder: [sortCriteria, FileSortCriteriaEnum.FileName, FileSortCriteriaEnum.RelativePath],
},
debouncedSearch,
);
Expand Down Expand Up @@ -173,7 +171,6 @@ function IgnoredFilesTab() {
rowSelection={rowSelection}
setSelectedRows={setRowSelection}
setSortCriteria={setSortCriteria}
skipSort={!!debouncedSearch}
sortCriteria={sortCriteria}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ function UnrecognizedTab() {
{
pageSize: 50,
include_only: ['Unrecognized'],
sortOrder: debouncedSearch
? []
: [sortCriteria, FileSortCriteriaEnum.FileName, FileSortCriteriaEnum.RelativePath],
sortOrder: [sortCriteria, FileSortCriteriaEnum.FileName, FileSortCriteriaEnum.RelativePath],
},
debouncedSearch,
);
Expand Down Expand Up @@ -402,7 +400,6 @@ function UnrecognizedTab() {
rowSelection={rowSelection}
setSelectedRows={setRowSelection}
setSortCriteria={setSortCriteria}
skipSort={!!debouncedSearch}
sortCriteria={sortCriteria}
/>
)}
Expand Down

0 comments on commit ce28270

Please sign in to comment.