@ventlio/tanstack-query 0.2.11 → 0.2.13

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.
package/README.md CHANGED
@@ -6,7 +6,7 @@ We have been working on a project using ReactJS and React-Native and we were hap
6
6
 
7
7
  However, we still faced some challenges. For each project, we have to configure how Tanstack-Query would connect to the Backend API and manage GET, POST, PUT, and PATCH requests efficiently. One of the major challenges was handling dynamic queryKeys in Tanstack-Query. For example, when building a screen with pagination, useQuery will have re-call the queryFunction every time the key changed, which will load the current page data. This meant that the queryKey changed dynamically, and sometimes we needed to use the queryKey of the current page to perform certain tasks like updating a specific row in the view. This was always tedious.
8
8
 
9
- But we were not discouraged. We knew that every challenge presented an opportunity for growth and development. So, we set out to find a solution. This package would handle dynamic queryKeys in Tanstack-Query and solve other related problems. It made configuring Tanstack-Query to connect to the Backend API and managing GET, POST, PUT, and PATCH requests a breeze. It also solved the problem of dynamic queryKeys, making it much easier to update specific rows in the view.
9
+ But we were not discouraged. So, we set out to find a solution which led to the development of this package. This package would handle dynamic queryKeys in Tanstack-Query and solve other related problems. It made configuring Tanstack-Query to connect to the Backend API and managing GET, POST, PUT, and PATCH requests a breeze. It also solved the problem of dynamic queryKeys, making it much easier to update specific rows in the view.
10
10
 
11
11
  ---
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ventlio/tanstack-query",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "contributors": [
@@ -4,10 +4,13 @@ import type { TanstackQueryConfig } from '../types';
4
4
  export const useQueryConfig = (): TanstackQueryConfig => {
5
5
  const queryClient = useQueryClient();
6
6
 
7
- const { headers, baseURL, timeout } =
8
- queryClient.getQueryData<TanstackQueryConfig>([
9
- 'config',
10
- ]) as TanstackQueryConfig;
7
+ const {
8
+ headers = {},
9
+ baseURL = '',
10
+ timeout = 10000,
11
+ } = queryClient.getQueryData<TanstackQueryConfig>([
12
+ 'config',
13
+ ]) as TanstackQueryConfig;
11
14
 
12
15
  return { headers, baseURL, timeout };
13
16
  };