@bigbinary/neeto-commons-frontend 2.1.22 → 2.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/react-utils.d.ts +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "2.1.22",
3
+ "version": "2.1.23",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
package/react-utils.d.ts CHANGED
@@ -3,10 +3,11 @@ import { RouteProps } from "react-router-dom";
3
3
  import { Notice } from "@honeybadger-io/js/dist/server/types/core/types";
4
4
  import { History } from "history";
5
5
  import { StoreApi, UseBoundStore } from "zustand";
6
- import { UseQueryOptions, UseQueryResult, UseMutationOptions, UseMutationResult } from "react-query";
6
+ import { UseQueryOptions, UseQueryResult, UseMutationOptions, UseMutationResult, QueryKey, MutationFunction } from "react-query";
7
7
  import { KeyPrefix, Namespace } from "i18next";
8
8
  import { DefaultNamespace } from "react-i18next/TransWithoutContext";
9
9
  import { qsOptionsType, QueryParamsType } from "./utils";
10
+ import { QueryFilters } from "react-query/types/core/utils";
10
11
  /**
11
12
  *
12
13
  * The HoneybadgerErrorBoundary is an ErrorBoundary which reports frontend errors
@@ -1348,6 +1349,7 @@ export const withT: <Props extends {
1348
1349
  withRef?: boolean;
1349
1350
  keyPrefix?: TKPrefix;
1350
1351
  }, ns?: N) => React.ComponentType<Props>;
1352
+ type QueryKeyOrFilters = QueryKey | QueryFilters;
1351
1353
  /**
1352
1354
  *
1353
1355
  * useMutationWithInvalidation is a wrapper function around the
@@ -1399,9 +1401,9 @@ export const withT: <Props extends {
1399
1401
  * });
1400
1402
  * @endexample
1401
1403
  */
1402
- export function useMutationWithInvalidation(mutationFn: () => Promise<T>, options: {
1403
- keysToInvalidate: Array<string | string[] | (() => string | string[])>;
1404
- } & UseMutationOptions): UseMutationResult<T>;
1404
+ export function useMutationWithInvalidation<TData = unknown, TError = unknown, TVariables = void, TContext = unknown>(mutationFn: MutationFunction<TData, TVariables>, options: {
1405
+ keysToInvalidate: Array<QueryKeyOrFilters | ((data: TData, variables: TVariables, context: TContext | undefined) => QueryKeyOrFilters)>;
1406
+ } & Omit<UseMutationOptions<TData, TError, TVariables, TContext>, 'mutationFn'>): UseMutationResult<TData, TError, TVariables, TContext>;
1405
1407
  /**
1406
1408
  *
1407
1409
  * The useQueryParams hook can be used to retrieve the query parameters whenever