@tanstack/solid-query 5.0.0-rc.1 → 5.0.0-rc.12
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/build/dev.cjs +2 -2
- package/build/dev.js +2 -2
- package/build/index.cjs +2 -2
- package/build/index.d.cts +2 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +2 -2
- package/package.json +2 -2
- package/src/QueryClient.ts +2 -2
- package/src/__tests__/createQuery.test.tsx +4 -3
- package/src/createBaseQuery.ts +2 -2
package/build/dev.cjs
CHANGED
|
@@ -83,7 +83,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
83
83
|
const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
|
|
84
84
|
const isRestoring = exports.useIsRestoring();
|
|
85
85
|
const defaultedOptions = solidJs.createMemo(
|
|
86
|
-
() => solidJs.mergeProps(client()
|
|
86
|
+
() => solidJs.mergeProps(client()?.defaultQueryOptions(options()) || {}, {
|
|
87
87
|
get _optimisticResults() {
|
|
88
88
|
return isRestoring() ? "isRestoring" : "optimistic";
|
|
89
89
|
},
|
|
@@ -124,7 +124,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
124
124
|
return reconcileFn(
|
|
125
125
|
store,
|
|
126
126
|
result,
|
|
127
|
-
reconcileOptions === void 0 ?
|
|
127
|
+
reconcileOptions === void 0 ? false : reconcileOptions
|
|
128
128
|
);
|
|
129
129
|
});
|
|
130
130
|
if (queryResource()?.data && result.data && !queryResource.loading && isRestoring())
|
package/build/dev.js
CHANGED
|
@@ -82,7 +82,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
82
82
|
const client = createMemo(() => useQueryClient(queryClient?.()));
|
|
83
83
|
const isRestoring = useIsRestoring();
|
|
84
84
|
const defaultedOptions = createMemo(
|
|
85
|
-
() => mergeProps(client()
|
|
85
|
+
() => mergeProps(client()?.defaultQueryOptions(options()) || {}, {
|
|
86
86
|
get _optimisticResults() {
|
|
87
87
|
return isRestoring() ? "isRestoring" : "optimistic";
|
|
88
88
|
},
|
|
@@ -123,7 +123,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
123
123
|
return reconcileFn(
|
|
124
124
|
store,
|
|
125
125
|
result,
|
|
126
|
-
reconcileOptions === void 0 ?
|
|
126
|
+
reconcileOptions === void 0 ? false : reconcileOptions
|
|
127
127
|
);
|
|
128
128
|
});
|
|
129
129
|
if (queryResource()?.data && result.data && !queryResource.loading && isRestoring())
|
package/build/index.cjs
CHANGED
|
@@ -83,7 +83,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
83
83
|
const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
|
|
84
84
|
const isRestoring = exports.useIsRestoring();
|
|
85
85
|
const defaultedOptions = solidJs.createMemo(
|
|
86
|
-
() => solidJs.mergeProps(client()
|
|
86
|
+
() => solidJs.mergeProps(client()?.defaultQueryOptions(options()) || {}, {
|
|
87
87
|
get _optimisticResults() {
|
|
88
88
|
return isRestoring() ? "isRestoring" : "optimistic";
|
|
89
89
|
},
|
|
@@ -124,7 +124,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
124
124
|
return reconcileFn(
|
|
125
125
|
store,
|
|
126
126
|
result,
|
|
127
|
-
reconcileOptions === void 0 ?
|
|
127
|
+
reconcileOptions === void 0 ? false : reconcileOptions
|
|
128
128
|
);
|
|
129
129
|
});
|
|
130
130
|
if (queryResource()?.data && result.data && !queryResource.loading && isRestoring())
|
package/build/index.d.cts
CHANGED
|
@@ -9,7 +9,7 @@ interface QueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TD
|
|
|
9
9
|
* Set this to a reconciliation key to enable reconciliation between query results.
|
|
10
10
|
* Set this to `false` to disable reconciliation between query results.
|
|
11
11
|
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
|
|
12
|
-
* Defaults reconciliation
|
|
12
|
+
* Defaults reconciliation to false.
|
|
13
13
|
*/
|
|
14
14
|
reconcile?: string | false | ((oldData: TData | undefined, newData: TData) => TData);
|
|
15
15
|
}
|
|
@@ -18,7 +18,7 @@ interface InfiniteQueryObserverOptions<TQueryFnData = unknown, TError = DefaultE
|
|
|
18
18
|
* Set this to a reconciliation key to enable reconciliation between query results.
|
|
19
19
|
* Set this to `false` to disable reconciliation between query results.
|
|
20
20
|
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
|
|
21
|
-
* Defaults reconciliation
|
|
21
|
+
* Defaults reconciliation to false.
|
|
22
22
|
*/
|
|
23
23
|
reconcile?: string | false | ((oldData: TData | undefined, newData: TData) => TData);
|
|
24
24
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ interface QueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TD
|
|
|
9
9
|
* Set this to a reconciliation key to enable reconciliation between query results.
|
|
10
10
|
* Set this to `false` to disable reconciliation between query results.
|
|
11
11
|
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
|
|
12
|
-
* Defaults reconciliation
|
|
12
|
+
* Defaults reconciliation to false.
|
|
13
13
|
*/
|
|
14
14
|
reconcile?: string | false | ((oldData: TData | undefined, newData: TData) => TData);
|
|
15
15
|
}
|
|
@@ -18,7 +18,7 @@ interface InfiniteQueryObserverOptions<TQueryFnData = unknown, TError = DefaultE
|
|
|
18
18
|
* Set this to a reconciliation key to enable reconciliation between query results.
|
|
19
19
|
* Set this to `false` to disable reconciliation between query results.
|
|
20
20
|
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
|
|
21
|
-
* Defaults reconciliation
|
|
21
|
+
* Defaults reconciliation to false.
|
|
22
22
|
*/
|
|
23
23
|
reconcile?: string | false | ((oldData: TData | undefined, newData: TData) => TData);
|
|
24
24
|
}
|
package/build/index.js
CHANGED
|
@@ -82,7 +82,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
82
82
|
const client = createMemo(() => useQueryClient(queryClient?.()));
|
|
83
83
|
const isRestoring = useIsRestoring();
|
|
84
84
|
const defaultedOptions = createMemo(
|
|
85
|
-
() => mergeProps(client()
|
|
85
|
+
() => mergeProps(client()?.defaultQueryOptions(options()) || {}, {
|
|
86
86
|
get _optimisticResults() {
|
|
87
87
|
return isRestoring() ? "isRestoring" : "optimistic";
|
|
88
88
|
},
|
|
@@ -123,7 +123,7 @@ function createBaseQuery(options, Observer, queryClient) {
|
|
|
123
123
|
return reconcileFn(
|
|
124
124
|
store,
|
|
125
125
|
result,
|
|
126
|
-
reconcileOptions === void 0 ?
|
|
126
|
+
reconcileOptions === void 0 ? false : reconcileOptions
|
|
127
127
|
);
|
|
128
128
|
});
|
|
129
129
|
if (queryResource()?.data && result.data && !queryResource.loading && isRestoring())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.12",
|
|
4
4
|
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"solid-js": "^1.7.8",
|
|
51
|
-
"@tanstack/query-core": "5.0.0-rc.
|
|
51
|
+
"@tanstack/query-core": "5.0.0-rc.12"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"tsup-preset-solid": "^2.0.1",
|
package/src/QueryClient.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface QueryObserverOptions<
|
|
|
30
30
|
* Set this to a reconciliation key to enable reconciliation between query results.
|
|
31
31
|
* Set this to `false` to disable reconciliation between query results.
|
|
32
32
|
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
|
|
33
|
-
* Defaults reconciliation
|
|
33
|
+
* Defaults reconciliation to false.
|
|
34
34
|
*/
|
|
35
35
|
reconcile?:
|
|
36
36
|
| string
|
|
@@ -60,7 +60,7 @@ export interface InfiniteQueryObserverOptions<
|
|
|
60
60
|
* Set this to a reconciliation key to enable reconciliation between query results.
|
|
61
61
|
* Set this to `false` to disable reconciliation between query results.
|
|
62
62
|
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
|
|
63
|
-
* Defaults reconciliation
|
|
63
|
+
* Defaults reconciliation to false.
|
|
64
64
|
*/
|
|
65
65
|
reconcile?:
|
|
66
66
|
| string
|
|
@@ -1046,6 +1046,7 @@ describe('createQuery', () => {
|
|
|
1046
1046
|
count++
|
|
1047
1047
|
return count === 1 ? result1 : result2
|
|
1048
1048
|
},
|
|
1049
|
+
reconcile: 'id',
|
|
1049
1050
|
}))
|
|
1050
1051
|
|
|
1051
1052
|
createRenderEffect(() => {
|
|
@@ -3714,7 +3715,7 @@ describe('createQuery', () => {
|
|
|
3714
3715
|
await sleep(10)
|
|
3715
3716
|
return count++
|
|
3716
3717
|
},
|
|
3717
|
-
refetchInterval: (data = 0) => (data < 2 ? 10 : false),
|
|
3718
|
+
refetchInterval: ({ state: { data = 0 } }) => (data < 2 ? 10 : false),
|
|
3718
3719
|
}))
|
|
3719
3720
|
|
|
3720
3721
|
createRenderEffect(() => {
|
|
@@ -5711,11 +5712,11 @@ describe('createQuery', () => {
|
|
|
5711
5712
|
<div>data: {state.data}</div>
|
|
5712
5713
|
<div>dataUpdatedAt: {state.dataUpdatedAt}</div>
|
|
5713
5714
|
<button
|
|
5714
|
-
onClick={() =>
|
|
5715
|
+
onClick={() => {
|
|
5715
5716
|
queryClient.setQueryData(key, 'newData', {
|
|
5716
5717
|
updatedAt: 100,
|
|
5717
5718
|
})
|
|
5718
|
-
}
|
|
5719
|
+
}}
|
|
5719
5720
|
>
|
|
5720
5721
|
setQueryData
|
|
5721
5722
|
</button>
|
package/src/createBaseQuery.ts
CHANGED
|
@@ -111,7 +111,7 @@ export function createBaseQuery<
|
|
|
111
111
|
const isRestoring = useIsRestoring()
|
|
112
112
|
|
|
113
113
|
const defaultedOptions = createMemo(() =>
|
|
114
|
-
mergeProps(client()
|
|
114
|
+
mergeProps(client()?.defaultQueryOptions(options()) || {}, {
|
|
115
115
|
get _optimisticResults() {
|
|
116
116
|
return isRestoring() ? 'isRestoring' : 'optimistic'
|
|
117
117
|
},
|
|
@@ -167,7 +167,7 @@ export function createBaseQuery<
|
|
|
167
167
|
return reconcileFn(
|
|
168
168
|
store,
|
|
169
169
|
result,
|
|
170
|
-
reconcileOptions === undefined ?
|
|
170
|
+
reconcileOptions === undefined ? false : reconcileOptions,
|
|
171
171
|
)
|
|
172
172
|
})
|
|
173
173
|
// If the query has data we dont suspend but instead mutate the resource
|