Skip to content

Commit 821d986

Browse files
committed
useQueryModels: add docstring
1 parent af3160b commit 821d986

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/components/src/public/QueryModel/useQueryModels.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,13 @@ interface UseQueryModelsOptions {
922922
modelLoader?: QueryModelLoader;
923923
}
924924

925+
/**
926+
* A hook that creates a managed set of QueryModels for a given QueryConfigMap returning InjectedQueryModels.
927+
* Functionally equivalent to withQueryModels but often more convenient because it doesn't require wrapping your
928+
* component. Note: changes to queryConfigs are not handled, useQueryModels only ever uses the original queryConfigs
929+
* object passed to it, as properly diffing the queryConfigs object is effectively impossible when considering user
930+
* changes to the models.
931+
*/
925932
export function useQueryModels(queryConfigs: QueryConfigMap, options: UseQueryModelsOptions = {}): InjectedQueryModels {
926933
const { autoLoad = false, modelLoader } = options;
927934
const [searchParams, setSearchParams] = useOptionalSearchParams();

0 commit comments

Comments
 (0)