@@ -274,12 +274,15 @@ export type CreateLoaderArgs<
274274 /** Generates an argument for the `queries` based on component props */
275275 queriesArg ?: ( props : TProps ) => TArg ;
276276 /** Determines what to render while loading (with no data to fallback on) */
277- onLoading ?: ( props : TProps ) => ReactElement ;
277+ onLoading ?: (
278+ props : TProps ,
279+ joinedQuery : UseQueryResult < TReturn >
280+ ) => ReactElement ;
278281 /** Determines what to render when query fails. */
279282 onError ?: (
280283 props : TProps ,
281284 error : FetchBaseQueryError | SerializedError ,
282- joinedQuery : UseQueryResult < undefined >
285+ joinedQuery : UseQueryResult < TReturn >
283286 ) => ReactElement ;
284287 /** @deprecated Using onFetching might result in loss of internal state. Use `whileFetching` instead, or pass the query to the component */
285288 onFetching ?: (
@@ -337,12 +340,15 @@ export type Loader<
337340 /** Generates an argument for the `queries` based on component props */
338341 queriesArg ?: ( props : TProps ) => TArg ;
339342 /** Determines what to render while loading (with no data to fallback on) */
340- onLoading ?: ( props : TProps ) => ReactElement ;
343+ onLoading ?: (
344+ props : TProps ,
345+ joinedQuery : UseQueryResult < TReturn >
346+ ) => ReactElement ;
341347 /** Determines what to render when query fails. */
342348 onError ?: (
343349 props : TProps ,
344350 error : SerializedError | FetchBaseQueryError ,
345- joinedQuery : UseQueryResult < undefined >
351+ joinedQuery : UseQueryResult < TReturn >
346352 ) => ReactElement ;
347353 /** @deprecated Using onFetching might result in loss of internal state. Use `whileFetching` instead, or pass the query to the component */
348354 onFetching ?: (
@@ -352,7 +358,17 @@ export type Loader<
352358 /** Determines what to render besides success-result while query is fetching. */
353359 whileFetching ?: WhileFetchingArgs < TProps , TReturn > ;
354360 config ?: LoaderConfig ;
355- /** Returns a new `Loader` extended from this `Loader`, with given overrides. */
361+ /**
362+ * Creates a `loader` that can be used to fetch data and render error & loading states.
363+ * @example
364+ * const loader = baseLoader.extend({
365+ * queriesArg: (props) => props.userId,
366+ * useQueries: (userId) => {
367+ * const user = useGetUserQuery(userId);
368+ * return { queries: { user } };
369+ * },
370+ * });
371+ */
356372 extend : <
357373 E_TQueries extends _TQueries = TQueries ,
358374 E_TDeferred extends _TDeferred = TDeferred ,
0 commit comments