feat(multi-select): enhance multi-select component with search and load more functionality
- Added onSearch and onLoadMore props to the MultiSelect component for improved user interaction. - Refactored state management to handle selected items and search queries more effectively. - Updated the CreateNotificationForm to integrate the new multi-select features for recipient selection. - Implemented infinite scrolling logic in the useCompaniesInfiniteQuery, useCustomersInfiniteQuery, and useAdminListInfiniteQuery hooks to support dynamic data loading. - Enhanced the useCreateNotificationFormPresenter to manage recipient search and loading states.
This commit is contained in:
@@ -100,7 +100,11 @@ export const useAdminDetails = (id: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const useAdminListInfiniteQuery = (params?: Record<string, any>) => {
|
||||
export const useAdminListInfiniteQuery = (
|
||||
params?: Record<string, any>,
|
||||
options?: { enabled?: boolean },
|
||||
) => {
|
||||
const enabled = options?.enabled ?? true;
|
||||
const queryKey = useMemo(() => [API_ENDPOINTS.USER.ADMINS, params], [params]);
|
||||
|
||||
return useInfiniteQuery({
|
||||
@@ -110,6 +114,7 @@ export const useAdminListInfiniteQuery = (params?: Record<string, any>) => {
|
||||
userService.adminsList({ ...params, offset: pageParam }),
|
||||
|
||||
initialPageParam: 0,
|
||||
enabled,
|
||||
|
||||
getNextPageParam: (lastPage) => {
|
||||
if (!lastPage.meta) {
|
||||
|
||||
Reference in New Issue
Block a user