Skip to content

Commit 824c304

Browse files
committed
feat: order
1 parent ed570ca commit 824c304

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

src/context/ActionViewContext.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export type ActionViewContextType = Omit<
7878
setSearchQuery?: (value: SearchQueryParams) => void;
7979
treeType?: TreeType;
8080
setTreeType?: (value: TreeType) => void;
81-
sortState?: ColumnState[];
82-
setSortState?: (value: ColumnState[] | undefined) => void;
81+
order?: ColumnState[];
82+
setOrder?: (value: ColumnState[] | undefined) => void;
8383
currentPage?: number;
8484
setCurrentPage?: (value: number) => void;
8585
};
@@ -152,7 +152,7 @@ const ActionViewProvider = (props: ActionViewProviderProps): any => {
152152
>(undefined);
153153
const [searchQuery, setSearchQuery] = useState<SearchQueryParams>();
154154
const [treeType, setTreeType] = useState<TreeType>(DEFAULT_TREE_TYPE);
155-
const [sortState, setSortState] = useState<ColumnState[]>();
155+
const [order, setOrder] = useState<ColumnState[]>();
156156

157157
const [limit, setLimit] = useState<number>(
158158
limitProps !== undefined ? limitProps : DEFAULT_SEARCH_LIMIT,
@@ -265,8 +265,8 @@ const ActionViewProvider = (props: ActionViewProviderProps): any => {
265265
setSearchQuery,
266266
treeType,
267267
setTreeType,
268-
sortState,
269-
setSortState,
268+
order,
269+
setOrder,
270270
currentPage,
271271
setCurrentPage,
272272
}}
@@ -347,8 +347,8 @@ export const useActionViewContext = () => {
347347
setSearchQuery: () => {},
348348
treeType: DEFAULT_TREE_TYPE,
349349
setTreeType: () => {},
350-
sortState: undefined,
351-
setSortState: () => {},
350+
order: undefined,
351+
setOrder: () => {},
352352
currentPage: 1,
353353
setCurrentPage: () => {},
354354
};

src/hooks/usePaginatedSearch.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export const usePaginatedSearch = (props: PaginatedSearchProps) => {
7878
isActive,
7979
currentPage,
8080
setCurrentPage,
81-
sortState: actionViewSortState,
82-
setSortState: setActionViewSortState,
81+
order: actionViewOrder,
82+
setOrder: setActionViewOrder,
8383
limit,
8484
setLimit,
8585
} = useSearchTreeState({ useLocalState: !rootTree });
@@ -283,7 +283,7 @@ export const usePaginatedSearch = (props: PaginatedSearchProps) => {
283283
mergedParams,
284284
nameSearch,
285285
domain,
286-
actionViewSortState,
286+
actionViewOrder,
287287
]);
288288

289289
useEffect(() => {
@@ -336,9 +336,9 @@ export const usePaginatedSearch = (props: PaginatedSearchProps) => {
336336
}
337337

338338
let order;
339-
if (actionViewSortState?.length) {
339+
if (actionViewOrder?.length) {
340340
const sortFields = getSortedFieldsFromState({
341-
state: actionViewSortState,
341+
state: actionViewOrder,
342342
});
343343
order = getOrderFromSortFields(sortFields);
344344
}
@@ -411,7 +411,7 @@ export const usePaginatedSearch = (props: PaginatedSearchProps) => {
411411
treeOoui,
412412
treeViewFetching,
413413
setTreeIsLoading,
414-
actionViewSortState,
414+
actionViewOrder,
415415
nameSearch,
416416
domain,
417417
mergedParams,
@@ -529,9 +529,8 @@ export const usePaginatedSearch = (props: PaginatedSearchProps) => {
529529
updateColumnState,
530530
currentPage,
531531
limit,
532-
sortState: actionViewSortState,
533-
setSortState: setActionViewSortState,
534-
treeFirstVisibleColumn,
532+
order: actionViewOrder,
533+
setOrder: setActionViewOrder,
535534
setTreeFirstVisibleColumn,
536535
onGetFirstVisibleColumn,
537536
};

src/hooks/useUrlFromCurrentTab.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function useUrlFromCurrentTab({
1313
}: {
1414
currentTab?: Tab;
1515
}): UseUrlFromCurrentTabResult {
16-
const { currentView, searchParams, currentId, limit, currentPage } =
16+
const { currentView, searchParams, currentId, limit, currentPage, order } =
1717
useActionViewContext();
1818
const { currentTab: currentTabContext } = useTabs();
1919

@@ -36,6 +36,7 @@ export function useUrlFromCurrentTab({
3636
...(currentId && { res_id: currentId }),
3737
...(limit && { limit }),
3838
...(currentPage && currentPage > 1 && { currentPage }),
39+
...(order && { order }),
3940
};
4041

4142
const shareUrl = createShareOpenUrl(finalActionData);

src/widgets/views/SearchTreeInfinite.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {
136136
setSearchQuery,
137137
setTotalItems: setTotalItemsActionView,
138138
isActive,
139-
sortState: actionViewSortState,
140-
setSortState: setActionViewSortState,
139+
order: actionViewSortState,
140+
setOrder: setActionViewSortState,
141141
} = useSearchTreeState({ useLocalState: !rootTree });
142142

143143
const nameSearch = nameSearchProps || searchTreeNameSearch;

src/widgets/views/Tree/Paginated/SearchTreePaginated.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ function SearchTreePaginatedComp(props: SearchTreePaginatedProps, ref: any) {
145145
updateColumnState,
146146
currentPage,
147147
limit,
148-
sortState: actionViewSortState,
149-
setSortState: setActionViewSortState,
148+
order: actionViewSortState,
149+
setOrder: setActionViewSortState,
150150
setTreeFirstVisibleColumn,
151151
onGetFirstVisibleColumn,
152152
} = usePaginatedSearch({

0 commit comments

Comments
 (0)