({
resource: resourceFromProp,
config,
filters,
hasPagination,
pagination,
sorters,
queryOptions,
successNotification,
errorNotification,
meta,
metaData,
liveMode,
onLiveEvent,
liveParams,
dataProviderName,
overtimeOptions,
}: UseListProps<TQueryFnData, TError, TData> = {})
| 124 | */ |
| 125 | |
| 126 | export const useList = < |
| 127 | TQueryFnData extends BaseRecord = BaseRecord, |
| 128 | TError extends HttpError = HttpError, |
| 129 | TData extends BaseRecord = TQueryFnData, |
| 130 | >({ |
| 131 | resource: resourceFromProp, |
| 132 | config, |
| 133 | filters, |
| 134 | hasPagination, |
| 135 | pagination, |
| 136 | sorters, |
| 137 | queryOptions, |
| 138 | successNotification, |
| 139 | errorNotification, |
| 140 | meta, |
| 141 | metaData, |
| 142 | liveMode, |
| 143 | onLiveEvent, |
| 144 | liveParams, |
| 145 | dataProviderName, |
| 146 | overtimeOptions, |
| 147 | }: UseListProps<TQueryFnData, TError, TData> = {}): QueryObserverResult< |
| 148 | GetListResponse<TData>, |
| 149 | TError |
| 150 | > & |
| 151 | UseLoadingOvertimeReturnType => { |
| 152 | const { resources, resource, identifier } = useResource(resourceFromProp); |
| 153 | |
| 154 | const dataProvider = useDataProvider(); |
| 155 | const translate = useTranslate(); |
| 156 | const authProvider = useActiveAuthProvider(); |
| 157 | const { mutate: checkError } = useOnError({ |
| 158 | v3LegacyAuthProviderCompatible: Boolean(authProvider?.isLegacy), |
| 159 | }); |
| 160 | const handleNotification = useHandleNotification(); |
| 161 | const getMeta = useMeta(); |
| 162 | const { keys, preferLegacyKeys } = useKeys(); |
| 163 | |
| 164 | const pickedDataProvider = pickDataProvider( |
| 165 | identifier, |
| 166 | dataProviderName, |
| 167 | resources, |
| 168 | ); |
| 169 | const preferredMeta = pickNotDeprecated(meta, metaData); |
| 170 | const prefferedFilters = pickNotDeprecated(filters, config?.filters); |
| 171 | const prefferedSorters = pickNotDeprecated(sorters, config?.sort); |
| 172 | const prefferedHasPagination = pickNotDeprecated( |
| 173 | hasPagination, |
| 174 | config?.hasPagination, |
| 175 | ); |
| 176 | const prefferedPagination = handlePaginationParams({ |
| 177 | pagination, |
| 178 | configPagination: config?.pagination, |
| 179 | hasPagination: prefferedHasPagination, |
| 180 | }); |
| 181 | const isServerPagination = prefferedPagination.mode === "server"; |
| 182 | |
| 183 | const combinedMeta = getMeta({ resource, meta: preferredMeta }); |
no test coverage detected