@tanstack/react-query 5.0.0-beta.2 → 5.0.0-beta.20
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/legacy/index.cjs +3 -0
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +3 -2
- package/build/legacy/index.d.ts +3 -2
- package/build/legacy/index.js +2 -0
- package/build/legacy/index.js.map +1 -1
- package/build/legacy/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +1 -1
- package/build/legacy/infiniteQueryOptions.d.ts +1 -1
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +4 -3
- package/build/legacy/queryOptions.d.ts +4 -3
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +4 -4
- package/build/legacy/types.d.ts +4 -4
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +2 -1
- package/build/legacy/useInfiniteQuery.d.ts +2 -1
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useQueries.cjs.map +1 -1
- package/build/legacy/useQueries.d.cts +4 -4
- package/build/legacy/useQueries.d.ts +4 -4
- package/build/legacy/useQueries.js.map +1 -1
- package/build/legacy/useQuery.cjs.map +1 -1
- package/build/legacy/useQuery.d.cts +2 -1
- package/build/legacy/useQuery.d.ts +2 -1
- package/build/legacy/useQuery.js.map +1 -1
- package/build/legacy/useSuspenseQueries.cjs +46 -0
- package/build/legacy/useSuspenseQueries.cjs.map +1 -0
- package/build/legacy/useSuspenseQueries.d.cts +66 -0
- package/build/legacy/useSuspenseQueries.d.ts +66 -0
- package/build/legacy/useSuspenseQueries.js +22 -0
- package/build/legacy/useSuspenseQueries.js.map +1 -0
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- package/build/legacy/utils.js.map +1 -1
- package/build/modern/index.cjs +3 -0
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.d.cts +3 -2
- package/build/modern/index.d.ts +3 -2
- package/build/modern/index.js +2 -0
- package/build/modern/index.js.map +1 -1
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +1 -1
- package/build/modern/infiniteQueryOptions.d.ts +1 -1
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +4 -3
- package/build/modern/queryOptions.d.ts +4 -3
- package/build/modern/queryOptions.js.map +1 -1
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +4 -4
- package/build/modern/types.d.ts +4 -4
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +2 -1
- package/build/modern/useInfiniteQuery.d.ts +2 -1
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useQueries.cjs.map +1 -1
- package/build/modern/useQueries.d.cts +4 -4
- package/build/modern/useQueries.d.ts +4 -4
- package/build/modern/useQueries.js.map +1 -1
- package/build/modern/useQuery.cjs.map +1 -1
- package/build/modern/useQuery.d.cts +2 -1
- package/build/modern/useQuery.d.ts +2 -1
- package/build/modern/useQuery.js.map +1 -1
- package/build/modern/useSuspenseQueries.cjs +46 -0
- package/build/modern/useSuspenseQueries.cjs.map +1 -0
- package/build/modern/useSuspenseQueries.d.cts +66 -0
- package/build/modern/useSuspenseQueries.d.ts +66 -0
- package/build/modern/useSuspenseQueries.js +22 -0
- package/build/modern/useSuspenseQueries.js.map +1 -0
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/build/modern/utils.js.map +1 -1
- package/package.json +8 -4
- package/src/__tests__/QueryResetErrorBoundary.test.tsx +10 -6
- package/src/__tests__/ssr.test.tsx +2 -2
- package/src/__tests__/suspense.test.tsx +34 -393
- package/src/__tests__/useInfiniteQuery.test.tsx +44 -44
- package/src/__tests__/useInfiniteQuery.type.test.tsx +24 -13
- package/src/__tests__/useIsFetching.test.tsx +2 -2
- package/src/__tests__/useMutation.test.tsx +4 -4
- package/src/__tests__/useMutationState.test.tsx +4 -4
- package/src/__tests__/useQueries.test.tsx +14 -12
- package/src/__tests__/useQuery.test.tsx +109 -80
- package/src/__tests__/useQuery.types.test.tsx +36 -55
- package/src/index.ts +13 -0
- package/src/infiniteQueryOptions.ts +3 -1
- package/src/queryOptions.ts +19 -7
- package/src/types.ts +18 -12
- package/src/useInfiniteQuery.ts +7 -2
- package/src/useQueries.ts +34 -28
- package/src/useQuery.ts +3 -1
- package/src/useSuspenseQueries.ts +163 -0
- package/src/utils.ts +1 -1
|
@@ -206,7 +206,7 @@ describe('useQuery', () => {
|
|
|
206
206
|
|
|
207
207
|
it('should return the correct states for a successful query', async () => {
|
|
208
208
|
const key = queryKey()
|
|
209
|
-
const states: UseQueryResult<string
|
|
209
|
+
const states: Array<UseQueryResult<string>> = []
|
|
210
210
|
|
|
211
211
|
function Page() {
|
|
212
212
|
const state = useQuery<string, Error>({
|
|
@@ -300,7 +300,7 @@ describe('useQuery', () => {
|
|
|
300
300
|
it('should return the correct states for an unsuccessful query', async () => {
|
|
301
301
|
const key = queryKey()
|
|
302
302
|
|
|
303
|
-
const states: UseQueryResult
|
|
303
|
+
const states: Array<UseQueryResult> = []
|
|
304
304
|
|
|
305
305
|
function Page() {
|
|
306
306
|
const state = useQuery({
|
|
@@ -549,7 +549,7 @@ describe('useQuery', () => {
|
|
|
549
549
|
|
|
550
550
|
it('should be able to watch a query without providing a query function', async () => {
|
|
551
551
|
const key = queryKey()
|
|
552
|
-
const states: UseQueryResult<string
|
|
552
|
+
const states: Array<UseQueryResult<string>> = []
|
|
553
553
|
|
|
554
554
|
queryClient.setQueryDefaults(key, { queryFn: () => 'data' })
|
|
555
555
|
|
|
@@ -570,7 +570,7 @@ describe('useQuery', () => {
|
|
|
570
570
|
|
|
571
571
|
it('should pick up a query when re-mounting with gcTime 0', async () => {
|
|
572
572
|
const key = queryKey()
|
|
573
|
-
const states: UseQueryResult<string
|
|
573
|
+
const states: Array<UseQueryResult<string>> = []
|
|
574
574
|
|
|
575
575
|
function Page() {
|
|
576
576
|
const [toggle, setToggle] = React.useState(false)
|
|
@@ -643,7 +643,7 @@ describe('useQuery', () => {
|
|
|
643
643
|
|
|
644
644
|
it('should not get into an infinite loop when removing a query with gcTime 0 and rerendering', async () => {
|
|
645
645
|
const key = queryKey()
|
|
646
|
-
const states: UseQueryResult<string
|
|
646
|
+
const states: Array<UseQueryResult<string>> = []
|
|
647
647
|
|
|
648
648
|
function Page() {
|
|
649
649
|
const [, rerender] = React.useState({})
|
|
@@ -705,7 +705,7 @@ describe('useQuery', () => {
|
|
|
705
705
|
|
|
706
706
|
it('should fetch when refetchOnMount is false and nothing has been fetched yet', async () => {
|
|
707
707
|
const key = queryKey()
|
|
708
|
-
const states: UseQueryResult<string
|
|
708
|
+
const states: Array<UseQueryResult<string>> = []
|
|
709
709
|
|
|
710
710
|
function Page() {
|
|
711
711
|
const state = useQuery({
|
|
@@ -728,7 +728,7 @@ describe('useQuery', () => {
|
|
|
728
728
|
|
|
729
729
|
it('should not fetch when refetchOnMount is false and data has been fetched already', async () => {
|
|
730
730
|
const key = queryKey()
|
|
731
|
-
const states: UseQueryResult<string
|
|
731
|
+
const states: Array<UseQueryResult<string>> = []
|
|
732
732
|
|
|
733
733
|
queryClient.setQueryData(key, 'prefetched')
|
|
734
734
|
|
|
@@ -752,7 +752,7 @@ describe('useQuery', () => {
|
|
|
752
752
|
|
|
753
753
|
it('should be able to select a part of the data with select', async () => {
|
|
754
754
|
const key = queryKey()
|
|
755
|
-
const states: UseQueryResult<string
|
|
755
|
+
const states: Array<UseQueryResult<string>> = []
|
|
756
756
|
|
|
757
757
|
function Page() {
|
|
758
758
|
const state = useQuery({
|
|
@@ -778,7 +778,7 @@ describe('useQuery', () => {
|
|
|
778
778
|
|
|
779
779
|
it('should be able to select a part of the data with select in object syntax', async () => {
|
|
780
780
|
const key = queryKey()
|
|
781
|
-
const states: UseQueryResult<string
|
|
781
|
+
const states: Array<UseQueryResult<string>> = []
|
|
782
782
|
|
|
783
783
|
function Page() {
|
|
784
784
|
const state = useQuery({
|
|
@@ -804,7 +804,7 @@ describe('useQuery', () => {
|
|
|
804
804
|
|
|
805
805
|
it('should throw an error when a selector throws', async () => {
|
|
806
806
|
const key = queryKey()
|
|
807
|
-
const states: UseQueryResult<string
|
|
807
|
+
const states: Array<UseQueryResult<string>> = []
|
|
808
808
|
const error = new Error('Select Error')
|
|
809
809
|
|
|
810
810
|
function Page() {
|
|
@@ -871,7 +871,7 @@ describe('useQuery', () => {
|
|
|
871
871
|
|
|
872
872
|
it('should track properties and only re-render when a tracked property changes', async () => {
|
|
873
873
|
const key = queryKey()
|
|
874
|
-
const states: UseQueryResult<string
|
|
874
|
+
const states: Array<UseQueryResult<string>> = []
|
|
875
875
|
|
|
876
876
|
function Page() {
|
|
877
877
|
const state = useQuery({
|
|
@@ -913,7 +913,7 @@ describe('useQuery', () => {
|
|
|
913
913
|
it('should always re-render if we are tracking props but not using any', async () => {
|
|
914
914
|
const key = queryKey()
|
|
915
915
|
let renderCount = 0
|
|
916
|
-
const states: UseQueryResult<string
|
|
916
|
+
const states: Array<UseQueryResult<string>> = []
|
|
917
917
|
|
|
918
918
|
function Page() {
|
|
919
919
|
const state = useQuery({ queryKey: key, queryFn: () => 'test' })
|
|
@@ -948,7 +948,7 @@ describe('useQuery', () => {
|
|
|
948
948
|
|
|
949
949
|
it('should be able to remove a query', async () => {
|
|
950
950
|
const key = queryKey()
|
|
951
|
-
const states: UseQueryResult<number
|
|
951
|
+
const states: Array<UseQueryResult<number>> = []
|
|
952
952
|
let count = 0
|
|
953
953
|
|
|
954
954
|
function Page() {
|
|
@@ -994,7 +994,7 @@ describe('useQuery', () => {
|
|
|
994
994
|
|
|
995
995
|
it('should create a new query when refetching a removed query', async () => {
|
|
996
996
|
const key = queryKey()
|
|
997
|
-
const states: UseQueryResult<number
|
|
997
|
+
const states: Array<UseQueryResult<number>> = []
|
|
998
998
|
let count = 0
|
|
999
999
|
|
|
1000
1000
|
function Page() {
|
|
@@ -1055,7 +1055,7 @@ describe('useQuery', () => {
|
|
|
1055
1055
|
{ id: '2', done: true },
|
|
1056
1056
|
]
|
|
1057
1057
|
|
|
1058
|
-
const states: UseQueryResult<typeof result1
|
|
1058
|
+
const states: Array<UseQueryResult<typeof result1>> = []
|
|
1059
1059
|
|
|
1060
1060
|
let count = 0
|
|
1061
1061
|
|
|
@@ -1110,7 +1110,7 @@ describe('useQuery', () => {
|
|
|
1110
1110
|
|
|
1111
1111
|
it('should use query function from hook when the existing query does not have a query function', async () => {
|
|
1112
1112
|
const key = queryKey()
|
|
1113
|
-
const results: DefinedUseQueryResult<string
|
|
1113
|
+
const results: Array<DefinedUseQueryResult<string>> = []
|
|
1114
1114
|
|
|
1115
1115
|
queryClient.setQueryData(key, 'set')
|
|
1116
1116
|
|
|
@@ -1154,7 +1154,7 @@ describe('useQuery', () => {
|
|
|
1154
1154
|
|
|
1155
1155
|
it('should update query stale state and refetch when invalidated with invalidateQueries', async () => {
|
|
1156
1156
|
const key = queryKey()
|
|
1157
|
-
const states: UseQueryResult<number
|
|
1157
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1158
1158
|
let count = 0
|
|
1159
1159
|
|
|
1160
1160
|
function Page() {
|
|
@@ -1223,7 +1223,7 @@ describe('useQuery', () => {
|
|
|
1223
1223
|
|
|
1224
1224
|
it('should not update disabled query when refetched with refetchQueries', async () => {
|
|
1225
1225
|
const key = queryKey()
|
|
1226
|
-
const states: UseQueryResult<number
|
|
1226
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1227
1227
|
let count = 0
|
|
1228
1228
|
|
|
1229
1229
|
function Page() {
|
|
@@ -1263,7 +1263,7 @@ describe('useQuery', () => {
|
|
|
1263
1263
|
|
|
1264
1264
|
it('should not refetch disabled query when invalidated with invalidateQueries', async () => {
|
|
1265
1265
|
const key = queryKey()
|
|
1266
|
-
const states: UseQueryResult<number
|
|
1266
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1267
1267
|
let count = 0
|
|
1268
1268
|
|
|
1269
1269
|
function Page() {
|
|
@@ -1303,7 +1303,7 @@ describe('useQuery', () => {
|
|
|
1303
1303
|
|
|
1304
1304
|
it('should not fetch when switching to a disabled query', async () => {
|
|
1305
1305
|
const key = queryKey()
|
|
1306
|
-
const states: UseQueryResult<number
|
|
1306
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1307
1307
|
|
|
1308
1308
|
function Page() {
|
|
1309
1309
|
const [count, setCount] = React.useState(0)
|
|
@@ -1366,7 +1366,7 @@ describe('useQuery', () => {
|
|
|
1366
1366
|
|
|
1367
1367
|
it('should keep the previous data when placeholderData is set', async () => {
|
|
1368
1368
|
const key = queryKey()
|
|
1369
|
-
const states: UseQueryResult<number
|
|
1369
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1370
1370
|
|
|
1371
1371
|
function Page() {
|
|
1372
1372
|
const [count, setCount] = React.useState(0)
|
|
@@ -1430,7 +1430,7 @@ describe('useQuery', () => {
|
|
|
1430
1430
|
|
|
1431
1431
|
it('should keep the previous data when placeholderData is set and select fn transform is used', async () => {
|
|
1432
1432
|
const key = queryKey()
|
|
1433
|
-
const states: UseQueryResult<number
|
|
1433
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1434
1434
|
|
|
1435
1435
|
function Page() {
|
|
1436
1436
|
const [count, setCount] = React.useState(0)
|
|
@@ -1498,9 +1498,9 @@ describe('useQuery', () => {
|
|
|
1498
1498
|
})
|
|
1499
1499
|
|
|
1500
1500
|
it('should keep the previous queryKey (from prevQuery) between multiple pending queries when placeholderData is set and select fn transform is used', async () => {
|
|
1501
|
-
const keys: Array<
|
|
1501
|
+
const keys: Array<ReadonlyArray<unknown> | null> = []
|
|
1502
1502
|
const key = queryKey()
|
|
1503
|
-
const states: UseQueryResult<number
|
|
1503
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1504
1504
|
|
|
1505
1505
|
function Page() {
|
|
1506
1506
|
const [count, setCount] = React.useState(0)
|
|
@@ -1553,7 +1553,7 @@ describe('useQuery', () => {
|
|
|
1553
1553
|
|
|
1554
1554
|
it('should show placeholderData between multiple pending queries when select fn transform is used', async () => {
|
|
1555
1555
|
const key = queryKey()
|
|
1556
|
-
const states: UseQueryResult<number
|
|
1556
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1557
1557
|
|
|
1558
1558
|
function Page() {
|
|
1559
1559
|
const [count, setCount] = React.useState(0)
|
|
@@ -1637,7 +1637,7 @@ describe('useQuery', () => {
|
|
|
1637
1637
|
|
|
1638
1638
|
it('should transition to error state when placeholderData is set', async () => {
|
|
1639
1639
|
const key = queryKey()
|
|
1640
|
-
const states: UseQueryResult<number
|
|
1640
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1641
1641
|
|
|
1642
1642
|
function Page({ count }: { count: number }) {
|
|
1643
1643
|
const state = useQuery<number, Error>({
|
|
@@ -1724,7 +1724,7 @@ describe('useQuery', () => {
|
|
|
1724
1724
|
|
|
1725
1725
|
it('should not show initial data from next query if placeholderData is set', async () => {
|
|
1726
1726
|
const key = queryKey()
|
|
1727
|
-
const states: DefinedUseQueryResult<number
|
|
1727
|
+
const states: Array<DefinedUseQueryResult<number>> = []
|
|
1728
1728
|
|
|
1729
1729
|
function Page() {
|
|
1730
1730
|
const [count, setCount] = React.useState(0)
|
|
@@ -1798,7 +1798,7 @@ describe('useQuery', () => {
|
|
|
1798
1798
|
|
|
1799
1799
|
it('should keep the previous data on disabled query when placeholderData is set', async () => {
|
|
1800
1800
|
const key = queryKey()
|
|
1801
|
-
const states: UseQueryResult<number
|
|
1801
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1802
1802
|
|
|
1803
1803
|
function Page() {
|
|
1804
1804
|
const [count, setCount] = React.useState(0)
|
|
@@ -1900,7 +1900,7 @@ describe('useQuery', () => {
|
|
|
1900
1900
|
|
|
1901
1901
|
it('should keep the previous data on disabled query when placeholderData is set and switching query key multiple times', async () => {
|
|
1902
1902
|
const key = queryKey()
|
|
1903
|
-
const states: UseQueryResult<number
|
|
1903
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1904
1904
|
|
|
1905
1905
|
queryClient.setQueryData([key, 10], 10)
|
|
1906
1906
|
|
|
@@ -1984,7 +1984,7 @@ describe('useQuery', () => {
|
|
|
1984
1984
|
|
|
1985
1985
|
it('should use the correct query function when components use different configurations', async () => {
|
|
1986
1986
|
const key = queryKey()
|
|
1987
|
-
const states: UseQueryResult<number
|
|
1987
|
+
const states: Array<UseQueryResult<number>> = []
|
|
1988
1988
|
|
|
1989
1989
|
function FirstComponent() {
|
|
1990
1990
|
const state = useQuery({
|
|
@@ -2045,8 +2045,8 @@ describe('useQuery', () => {
|
|
|
2045
2045
|
|
|
2046
2046
|
it('should be able to set different stale times for a query', async () => {
|
|
2047
2047
|
const key = queryKey()
|
|
2048
|
-
const states1: UseQueryResult<string
|
|
2049
|
-
const states2: UseQueryResult<string
|
|
2048
|
+
const states1: Array<UseQueryResult<string>> = []
|
|
2049
|
+
const states2: Array<UseQueryResult<string>> = []
|
|
2050
2050
|
|
|
2051
2051
|
await queryClient.prefetchQuery({
|
|
2052
2052
|
queryKey: key,
|
|
@@ -2146,7 +2146,7 @@ describe('useQuery', () => {
|
|
|
2146
2146
|
|
|
2147
2147
|
it('should re-render when a query becomes stale', async () => {
|
|
2148
2148
|
const key = queryKey()
|
|
2149
|
-
const states: UseQueryResult<string
|
|
2149
|
+
const states: Array<UseQueryResult<string>> = []
|
|
2150
2150
|
|
|
2151
2151
|
function Page() {
|
|
2152
2152
|
const state = useQuery({
|
|
@@ -2171,7 +2171,7 @@ describe('useQuery', () => {
|
|
|
2171
2171
|
describe('notifyOnChangeProps', () => {
|
|
2172
2172
|
it('should not re-render when it should only re-render only data change and the selected data did not change', async () => {
|
|
2173
2173
|
const key = queryKey()
|
|
2174
|
-
const states: UseQueryResult<string
|
|
2174
|
+
const states: Array<UseQueryResult<string>> = []
|
|
2175
2175
|
|
|
2176
2176
|
function Page() {
|
|
2177
2177
|
const state = useQuery({
|
|
@@ -2212,7 +2212,7 @@ describe('useQuery', () => {
|
|
|
2212
2212
|
})
|
|
2213
2213
|
it('should not re-render when it should only re-render on data changes and the data did not change', async () => {
|
|
2214
2214
|
const key = queryKey()
|
|
2215
|
-
const states: UseQueryResult<string
|
|
2215
|
+
const states: Array<UseQueryResult<string>> = []
|
|
2216
2216
|
|
|
2217
2217
|
function Page() {
|
|
2218
2218
|
const state = useQuery({
|
|
@@ -2270,7 +2270,7 @@ describe('useQuery', () => {
|
|
|
2270
2270
|
describe('function', () => {
|
|
2271
2271
|
it('should not re-render when it should only re-render on data changes and the data did not change', async () => {
|
|
2272
2272
|
const key = queryKey()
|
|
2273
|
-
const states: UseQueryResult<string
|
|
2273
|
+
const states: Array<UseQueryResult<string>> = []
|
|
2274
2274
|
|
|
2275
2275
|
function Page() {
|
|
2276
2276
|
const state = useQuery({
|
|
@@ -2325,7 +2325,7 @@ describe('useQuery', () => {
|
|
|
2325
2325
|
|
|
2326
2326
|
it('should not re-render when change props are not actively being tracked', async () => {
|
|
2327
2327
|
const key = queryKey()
|
|
2328
|
-
const states: UseQueryResult<string
|
|
2328
|
+
const states: Array<UseQueryResult<string>> = []
|
|
2329
2329
|
|
|
2330
2330
|
function Page() {
|
|
2331
2331
|
const fetchCounterRef = React.useRef(0)
|
|
@@ -2410,6 +2410,9 @@ describe('useQuery', () => {
|
|
|
2410
2410
|
)
|
|
2411
2411
|
fireEvent.click(rendered.getByRole('button', { name: 'refetch' }))
|
|
2412
2412
|
|
|
2413
|
+
await waitFor(() => {
|
|
2414
|
+
rendered.getByText('fetch counter: 3')
|
|
2415
|
+
})
|
|
2413
2416
|
// sleep is required to make sure no additional renders happen after click
|
|
2414
2417
|
await sleep(20)
|
|
2415
2418
|
|
|
@@ -2600,7 +2603,7 @@ describe('useQuery', () => {
|
|
|
2600
2603
|
|
|
2601
2604
|
it('should not refetch query on focus when `enabled` is set to `false`', async () => {
|
|
2602
2605
|
const key = queryKey()
|
|
2603
|
-
const queryFn = vi.fn<unknown
|
|
2606
|
+
const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
|
|
2604
2607
|
|
|
2605
2608
|
function Page() {
|
|
2606
2609
|
const { data = 'default' } = useQuery({
|
|
@@ -2629,7 +2632,7 @@ describe('useQuery', () => {
|
|
|
2629
2632
|
|
|
2630
2633
|
it('should not refetch stale query on focus when `refetchOnWindowFocus` is set to `false`', async () => {
|
|
2631
2634
|
const key = queryKey()
|
|
2632
|
-
const states: UseQueryResult<number
|
|
2635
|
+
const states: Array<UseQueryResult<number>> = []
|
|
2633
2636
|
let count = 0
|
|
2634
2637
|
|
|
2635
2638
|
function Page() {
|
|
@@ -2660,7 +2663,7 @@ describe('useQuery', () => {
|
|
|
2660
2663
|
|
|
2661
2664
|
it('should not refetch stale query on focus when `refetchOnWindowFocus` is set to a function that returns `false`', async () => {
|
|
2662
2665
|
const key = queryKey()
|
|
2663
|
-
const states: UseQueryResult<number
|
|
2666
|
+
const states: Array<UseQueryResult<number>> = []
|
|
2664
2667
|
let count = 0
|
|
2665
2668
|
|
|
2666
2669
|
function Page() {
|
|
@@ -2691,7 +2694,7 @@ describe('useQuery', () => {
|
|
|
2691
2694
|
|
|
2692
2695
|
it('should not refetch fresh query on focus when `refetchOnWindowFocus` is set to `true`', async () => {
|
|
2693
2696
|
const key = queryKey()
|
|
2694
|
-
const states: UseQueryResult<number
|
|
2697
|
+
const states: Array<UseQueryResult<number>> = []
|
|
2695
2698
|
let count = 0
|
|
2696
2699
|
|
|
2697
2700
|
function Page() {
|
|
@@ -2722,7 +2725,7 @@ describe('useQuery', () => {
|
|
|
2722
2725
|
|
|
2723
2726
|
it('should refetch fresh query on focus when `refetchOnWindowFocus` is set to `always`', async () => {
|
|
2724
2727
|
const key = queryKey()
|
|
2725
|
-
const states: UseQueryResult<number
|
|
2728
|
+
const states: Array<UseQueryResult<number>> = []
|
|
2726
2729
|
let count = 0
|
|
2727
2730
|
|
|
2728
2731
|
function Page() {
|
|
@@ -2759,7 +2762,7 @@ describe('useQuery', () => {
|
|
|
2759
2762
|
|
|
2760
2763
|
it('should calculate focus behaviour for `refetchOnWindowFocus` depending on function', async () => {
|
|
2761
2764
|
const key = queryKey()
|
|
2762
|
-
const states: UseQueryResult<number
|
|
2765
|
+
const states: Array<UseQueryResult<number>> = []
|
|
2763
2766
|
let count = 0
|
|
2764
2767
|
|
|
2765
2768
|
function Page() {
|
|
@@ -2810,7 +2813,7 @@ describe('useQuery', () => {
|
|
|
2810
2813
|
|
|
2811
2814
|
it('should refetch fresh query when refetchOnMount is set to always', async () => {
|
|
2812
2815
|
const key = queryKey()
|
|
2813
|
-
const states: UseQueryResult<string
|
|
2816
|
+
const states: Array<UseQueryResult<string>> = []
|
|
2814
2817
|
|
|
2815
2818
|
await queryClient.prefetchQuery({
|
|
2816
2819
|
queryKey: key,
|
|
@@ -2847,7 +2850,7 @@ describe('useQuery', () => {
|
|
|
2847
2850
|
|
|
2848
2851
|
it('should refetch stale query when refetchOnMount is set to true', async () => {
|
|
2849
2852
|
const key = queryKey()
|
|
2850
|
-
const states: UseQueryResult<string
|
|
2853
|
+
const states: Array<UseQueryResult<string>> = []
|
|
2851
2854
|
|
|
2852
2855
|
await queryClient.prefetchQuery({
|
|
2853
2856
|
queryKey: key,
|
|
@@ -2885,6 +2888,9 @@ describe('useQuery', () => {
|
|
|
2885
2888
|
})
|
|
2886
2889
|
|
|
2887
2890
|
it('should set status to error if queryFn throws', async () => {
|
|
2891
|
+
const consoleMock = vi
|
|
2892
|
+
.spyOn(console, 'error')
|
|
2893
|
+
.mockImplementation(() => undefined)
|
|
2888
2894
|
const key = queryKey()
|
|
2889
2895
|
|
|
2890
2896
|
function Page() {
|
|
@@ -2908,6 +2914,8 @@ describe('useQuery', () => {
|
|
|
2908
2914
|
|
|
2909
2915
|
await waitFor(() => rendered.getByText('error'))
|
|
2910
2916
|
await waitFor(() => rendered.getByText('Error test jaylen'))
|
|
2917
|
+
|
|
2918
|
+
consoleMock.mockRestore()
|
|
2911
2919
|
})
|
|
2912
2920
|
|
|
2913
2921
|
it('should throw error if queryFn throws and throwOnError is in use', async () => {
|
|
@@ -3151,7 +3159,7 @@ describe('useQuery', () => {
|
|
|
3151
3159
|
|
|
3152
3160
|
it('should always fetch if refetchOnMount is set to always', async () => {
|
|
3153
3161
|
const key = queryKey()
|
|
3154
|
-
const states: UseQueryResult<string
|
|
3162
|
+
const states: Array<UseQueryResult<string>> = []
|
|
3155
3163
|
|
|
3156
3164
|
await queryClient.prefetchQuery({
|
|
3157
3165
|
queryKey: key,
|
|
@@ -3199,7 +3207,7 @@ describe('useQuery', () => {
|
|
|
3199
3207
|
|
|
3200
3208
|
it('should fetch if initial data is set', async () => {
|
|
3201
3209
|
const key = queryKey()
|
|
3202
|
-
const states: DefinedUseQueryResult<string
|
|
3210
|
+
const states: Array<DefinedUseQueryResult<string>> = []
|
|
3203
3211
|
|
|
3204
3212
|
function Page() {
|
|
3205
3213
|
const state = useQuery({
|
|
@@ -3231,7 +3239,7 @@ describe('useQuery', () => {
|
|
|
3231
3239
|
|
|
3232
3240
|
it('should not fetch if initial data is set with a stale time', async () => {
|
|
3233
3241
|
const key = queryKey()
|
|
3234
|
-
const states: DefinedUseQueryResult<string
|
|
3242
|
+
const states: Array<DefinedUseQueryResult<string>> = []
|
|
3235
3243
|
|
|
3236
3244
|
function Page() {
|
|
3237
3245
|
const state = useQuery({
|
|
@@ -3263,7 +3271,7 @@ describe('useQuery', () => {
|
|
|
3263
3271
|
|
|
3264
3272
|
it('should fetch if initial data updated at is older than stale time', async () => {
|
|
3265
3273
|
const key = queryKey()
|
|
3266
|
-
const states: DefinedUseQueryResult<string
|
|
3274
|
+
const states: Array<DefinedUseQueryResult<string>> = []
|
|
3267
3275
|
|
|
3268
3276
|
const oneSecondAgo = Date.now() - 1000
|
|
3269
3277
|
|
|
@@ -3303,7 +3311,7 @@ describe('useQuery', () => {
|
|
|
3303
3311
|
|
|
3304
3312
|
it('should fetch if "initial data updated at" is exactly 0', async () => {
|
|
3305
3313
|
const key = queryKey()
|
|
3306
|
-
const states: DefinedUseQueryResult<string
|
|
3314
|
+
const states: Array<DefinedUseQueryResult<string>> = []
|
|
3307
3315
|
|
|
3308
3316
|
function Page() {
|
|
3309
3317
|
const state = useQuery({
|
|
@@ -3336,7 +3344,7 @@ describe('useQuery', () => {
|
|
|
3336
3344
|
|
|
3337
3345
|
it('should keep initial data when the query key changes', async () => {
|
|
3338
3346
|
const key = queryKey()
|
|
3339
|
-
const states: DefinedUseQueryResult<{ count: number }
|
|
3347
|
+
const states: Array<DefinedUseQueryResult<{ count: number }>> = []
|
|
3340
3348
|
|
|
3341
3349
|
function Page() {
|
|
3342
3350
|
const [count, setCount] = React.useState(0)
|
|
@@ -3371,7 +3379,7 @@ describe('useQuery', () => {
|
|
|
3371
3379
|
it('should retry specified number of times', async () => {
|
|
3372
3380
|
const key = queryKey()
|
|
3373
3381
|
|
|
3374
|
-
const queryFn = vi.fn<unknown
|
|
3382
|
+
const queryFn = vi.fn<Array<unknown>, unknown>()
|
|
3375
3383
|
queryFn.mockImplementation(() => {
|
|
3376
3384
|
return Promise.reject(new Error('Error test Barrett'))
|
|
3377
3385
|
})
|
|
@@ -3408,7 +3416,7 @@ describe('useQuery', () => {
|
|
|
3408
3416
|
it('should not retry if retry function `false`', async () => {
|
|
3409
3417
|
const key = queryKey()
|
|
3410
3418
|
|
|
3411
|
-
const queryFn = vi.fn<unknown
|
|
3419
|
+
const queryFn = vi.fn<Array<unknown>, unknown>()
|
|
3412
3420
|
|
|
3413
3421
|
queryFn.mockImplementationOnce(() => {
|
|
3414
3422
|
return Promise.reject(new Error('Error test Tanner'))
|
|
@@ -3454,7 +3462,7 @@ describe('useQuery', () => {
|
|
|
3454
3462
|
|
|
3455
3463
|
type DelayError = { delay: number }
|
|
3456
3464
|
|
|
3457
|
-
const queryFn = vi.fn<unknown
|
|
3465
|
+
const queryFn = vi.fn<Array<unknown>, unknown>()
|
|
3458
3466
|
queryFn.mockImplementation(() => {
|
|
3459
3467
|
return Promise.reject({ delay: 50 })
|
|
3460
3468
|
})
|
|
@@ -3551,7 +3559,7 @@ describe('useQuery', () => {
|
|
|
3551
3559
|
|
|
3552
3560
|
it('should fetch on mount when a query was already created with setQueryData', async () => {
|
|
3553
3561
|
const key = queryKey()
|
|
3554
|
-
const states: UseQueryResult<string
|
|
3562
|
+
const states: Array<UseQueryResult<string>> = []
|
|
3555
3563
|
|
|
3556
3564
|
queryClient.setQueryData(key, 'prefetched')
|
|
3557
3565
|
|
|
@@ -3582,7 +3590,7 @@ describe('useQuery', () => {
|
|
|
3582
3590
|
|
|
3583
3591
|
it('should refetch after focus regain', async () => {
|
|
3584
3592
|
const key = queryKey()
|
|
3585
|
-
const states: UseQueryResult<string
|
|
3593
|
+
const states: Array<UseQueryResult<string>> = []
|
|
3586
3594
|
|
|
3587
3595
|
// make page unfocused
|
|
3588
3596
|
const visibilityMock = mockVisibilityState('hidden')
|
|
@@ -3645,12 +3653,12 @@ describe('useQuery', () => {
|
|
|
3645
3653
|
// See https://github.com/tannerlinsley/react-query/issues/195
|
|
3646
3654
|
it('should refetch if stale after a prefetch', async () => {
|
|
3647
3655
|
const key = queryKey()
|
|
3648
|
-
const states: UseQueryResult<string
|
|
3656
|
+
const states: Array<UseQueryResult<string>> = []
|
|
3649
3657
|
|
|
3650
|
-
const queryFn = vi.fn<unknown
|
|
3658
|
+
const queryFn = vi.fn<Array<unknown>, string>()
|
|
3651
3659
|
queryFn.mockImplementation(() => 'data')
|
|
3652
3660
|
|
|
3653
|
-
const prefetchQueryFn = vi.fn<unknown
|
|
3661
|
+
const prefetchQueryFn = vi.fn<Array<unknown>, string>()
|
|
3654
3662
|
prefetchQueryFn.mockImplementation(() => 'not yet...')
|
|
3655
3663
|
|
|
3656
3664
|
await queryClient.prefetchQuery({
|
|
@@ -3678,10 +3686,10 @@ describe('useQuery', () => {
|
|
|
3678
3686
|
it('should not refetch if not stale after a prefetch', async () => {
|
|
3679
3687
|
const key = queryKey()
|
|
3680
3688
|
|
|
3681
|
-
const queryFn = vi.fn<unknown
|
|
3689
|
+
const queryFn = vi.fn<Array<unknown>, string>()
|
|
3682
3690
|
queryFn.mockImplementation(() => 'data')
|
|
3683
3691
|
|
|
3684
|
-
const prefetchQueryFn = vi.fn<unknown
|
|
3692
|
+
const prefetchQueryFn = vi.fn<Array<unknown>, Promise<string>>()
|
|
3685
3693
|
prefetchQueryFn.mockImplementation(async () => {
|
|
3686
3694
|
await sleep(10)
|
|
3687
3695
|
return 'not yet...'
|
|
@@ -3833,7 +3841,7 @@ describe('useQuery', () => {
|
|
|
3833
3841
|
|
|
3834
3842
|
it('should mark query as fetching, when using initialData', async () => {
|
|
3835
3843
|
const key = queryKey()
|
|
3836
|
-
const results: DefinedUseQueryResult<string
|
|
3844
|
+
const results: Array<DefinedUseQueryResult<string>> = []
|
|
3837
3845
|
|
|
3838
3846
|
function Page() {
|
|
3839
3847
|
const result = useQuery({
|
|
@@ -3860,7 +3868,7 @@ describe('useQuery', () => {
|
|
|
3860
3868
|
|
|
3861
3869
|
it('should initialize state properly, when initialData is falsy', async () => {
|
|
3862
3870
|
const key = queryKey()
|
|
3863
|
-
const results: DefinedUseQueryResult<number
|
|
3871
|
+
const results: Array<DefinedUseQueryResult<number>> = []
|
|
3864
3872
|
|
|
3865
3873
|
function Page() {
|
|
3866
3874
|
const result = useQuery({
|
|
@@ -3937,7 +3945,7 @@ describe('useQuery', () => {
|
|
|
3937
3945
|
// // See https://github.com/tannerlinsley/react-query/issues/214
|
|
3938
3946
|
it('data should persist when enabled is changed to false', async () => {
|
|
3939
3947
|
const key = queryKey()
|
|
3940
|
-
const results: DefinedUseQueryResult<string
|
|
3948
|
+
const results: Array<DefinedUseQueryResult<string>> = []
|
|
3941
3949
|
|
|
3942
3950
|
function Page() {
|
|
3943
3951
|
const [shouldFetch, setShouldFetch] = React.useState(true)
|
|
@@ -3988,7 +3996,7 @@ describe('useQuery', () => {
|
|
|
3988
3996
|
|
|
3989
3997
|
it('it should support enabled:false in query object syntax', async () => {
|
|
3990
3998
|
const key = queryKey()
|
|
3991
|
-
const queryFn = vi.fn<unknown
|
|
3999
|
+
const queryFn = vi.fn<Array<unknown>, string>()
|
|
3992
4000
|
queryFn.mockImplementation(() => 'data')
|
|
3993
4001
|
|
|
3994
4002
|
function Page() {
|
|
@@ -4082,7 +4090,7 @@ describe('useQuery', () => {
|
|
|
4082
4090
|
|
|
4083
4091
|
it('should not cause memo churn when data does not change', async () => {
|
|
4084
4092
|
const key = queryKey()
|
|
4085
|
-
const queryFn = vi.fn<unknown
|
|
4093
|
+
const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
|
|
4086
4094
|
const memoFn = vi.fn()
|
|
4087
4095
|
|
|
4088
4096
|
function Page() {
|
|
@@ -4157,7 +4165,7 @@ describe('useQuery', () => {
|
|
|
4157
4165
|
it('should refetch in an interval depending on function result', async () => {
|
|
4158
4166
|
const key = queryKey()
|
|
4159
4167
|
let count = 0
|
|
4160
|
-
const states: UseQueryResult<number
|
|
4168
|
+
const states: Array<UseQueryResult<number>> = []
|
|
4161
4169
|
|
|
4162
4170
|
function Page() {
|
|
4163
4171
|
const queryInfo = useQuery({
|
|
@@ -4223,7 +4231,7 @@ describe('useQuery', () => {
|
|
|
4223
4231
|
|
|
4224
4232
|
it('should not interval fetch with a refetchInterval of 0', async () => {
|
|
4225
4233
|
const key = queryKey()
|
|
4226
|
-
const states: UseQueryResult<number
|
|
4234
|
+
const states: Array<UseQueryResult<number>> = []
|
|
4227
4235
|
|
|
4228
4236
|
function Page() {
|
|
4229
4237
|
const queryInfo = useQuery({
|
|
@@ -4290,7 +4298,7 @@ describe('useQuery', () => {
|
|
|
4290
4298
|
it('should refetch if any query instance becomes enabled', async () => {
|
|
4291
4299
|
const key = queryKey()
|
|
4292
4300
|
|
|
4293
|
-
const queryFn = vi.fn<unknown
|
|
4301
|
+
const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
|
|
4294
4302
|
|
|
4295
4303
|
function Disabled() {
|
|
4296
4304
|
useQuery({ queryKey: key, queryFn, enabled: false })
|
|
@@ -4319,7 +4327,7 @@ describe('useQuery', () => {
|
|
|
4319
4327
|
it('should use placeholder data while the query loads', async () => {
|
|
4320
4328
|
const key1 = queryKey()
|
|
4321
4329
|
|
|
4322
|
-
const states: UseQueryResult<string
|
|
4330
|
+
const states: Array<UseQueryResult<string>> = []
|
|
4323
4331
|
|
|
4324
4332
|
function Page() {
|
|
4325
4333
|
const state = useQuery({
|
|
@@ -4358,7 +4366,7 @@ describe('useQuery', () => {
|
|
|
4358
4366
|
it('should use placeholder data even for disabled queries', async () => {
|
|
4359
4367
|
const key1 = queryKey()
|
|
4360
4368
|
|
|
4361
|
-
const states: { state: UseQueryResult<string>; count: number }
|
|
4369
|
+
const states: Array<{ state: UseQueryResult<string>; count: number }> = []
|
|
4362
4370
|
|
|
4363
4371
|
function Page() {
|
|
4364
4372
|
const [count, setCount] = React.useState(0)
|
|
@@ -4418,7 +4426,7 @@ describe('useQuery', () => {
|
|
|
4418
4426
|
it('placeholder data should run through select', async () => {
|
|
4419
4427
|
const key1 = queryKey()
|
|
4420
4428
|
|
|
4421
|
-
const states: UseQueryResult<string
|
|
4429
|
+
const states: Array<UseQueryResult<string>> = []
|
|
4422
4430
|
|
|
4423
4431
|
function Page() {
|
|
4424
4432
|
const state = useQuery({
|
|
@@ -4458,7 +4466,7 @@ describe('useQuery', () => {
|
|
|
4458
4466
|
it('placeholder data function result should run through select', async () => {
|
|
4459
4467
|
const key1 = queryKey()
|
|
4460
4468
|
|
|
4461
|
-
const states: UseQueryResult<string
|
|
4469
|
+
const states: Array<UseQueryResult<string>> = []
|
|
4462
4470
|
let placeholderFunctionRunCount = 0
|
|
4463
4471
|
|
|
4464
4472
|
function Page() {
|
|
@@ -4684,7 +4692,7 @@ describe('useQuery', () => {
|
|
|
4684
4692
|
|
|
4685
4693
|
it('should cancel the query if the signal was consumed and there are no more subscriptions', async () => {
|
|
4686
4694
|
const key = queryKey()
|
|
4687
|
-
const states: UseQueryResult<string
|
|
4695
|
+
const states: Array<UseQueryResult<string>> = []
|
|
4688
4696
|
|
|
4689
4697
|
const queryFn: QueryFunction<string, [typeof key, number]> = async (
|
|
4690
4698
|
ctx,
|
|
@@ -4749,7 +4757,7 @@ describe('useQuery', () => {
|
|
|
4749
4757
|
|
|
4750
4758
|
it('should refetch when quickly switching to a failed query', async () => {
|
|
4751
4759
|
const key = queryKey()
|
|
4752
|
-
const states: UseQueryResult<string
|
|
4760
|
+
const states: Array<UseQueryResult<string>> = []
|
|
4753
4761
|
|
|
4754
4762
|
const queryFn = async () => {
|
|
4755
4763
|
await sleep(50)
|
|
@@ -4800,7 +4808,7 @@ describe('useQuery', () => {
|
|
|
4800
4808
|
|
|
4801
4809
|
it('should update query state and refetch when reset with resetQueries', async () => {
|
|
4802
4810
|
const key = queryKey()
|
|
4803
|
-
const states: UseQueryResult<number
|
|
4811
|
+
const states: Array<UseQueryResult<number>> = []
|
|
4804
4812
|
let count = 0
|
|
4805
4813
|
|
|
4806
4814
|
function Page() {
|
|
@@ -4870,7 +4878,7 @@ describe('useQuery', () => {
|
|
|
4870
4878
|
|
|
4871
4879
|
it('should update query state and not refetch when resetting a disabled query with resetQueries', async () => {
|
|
4872
4880
|
const key = queryKey()
|
|
4873
|
-
const states: UseQueryResult<number
|
|
4881
|
+
const states: Array<UseQueryResult<number>> = []
|
|
4874
4882
|
let count = 0
|
|
4875
4883
|
|
|
4876
4884
|
function Page() {
|
|
@@ -4972,7 +4980,7 @@ describe('useQuery', () => {
|
|
|
4972
4980
|
})
|
|
4973
4981
|
|
|
4974
4982
|
it('should refetch when changed enabled to true in error state', async () => {
|
|
4975
|
-
const queryFn = vi.fn<unknown
|
|
4983
|
+
const queryFn = vi.fn<Array<unknown>, unknown>()
|
|
4976
4984
|
queryFn.mockImplementation(async () => {
|
|
4977
4985
|
await sleep(10)
|
|
4978
4986
|
return Promise.reject(new Error('Suspense Error Bingo'))
|
|
@@ -5144,7 +5152,7 @@ describe('useQuery', () => {
|
|
|
5144
5152
|
|
|
5145
5153
|
it('should have no error in pending state when refetching after error occurred', async () => {
|
|
5146
5154
|
const key = queryKey()
|
|
5147
|
-
const states: UseQueryResult<number
|
|
5155
|
+
const states: Array<UseQueryResult<number>> = []
|
|
5148
5156
|
const error = new Error('oops')
|
|
5149
5157
|
|
|
5150
5158
|
let count = 0
|
|
@@ -5954,7 +5962,7 @@ describe('useQuery', () => {
|
|
|
5954
5962
|
|
|
5955
5963
|
it('it should have status=error on mount when a query has failed', async () => {
|
|
5956
5964
|
const key = queryKey()
|
|
5957
|
-
const states: UseQueryResult<unknown
|
|
5965
|
+
const states: Array<UseQueryResult<unknown>> = []
|
|
5958
5966
|
const error = new Error('oops')
|
|
5959
5967
|
|
|
5960
5968
|
const queryFn = async (): Promise<unknown> => {
|
|
@@ -6225,4 +6233,25 @@ describe('useQuery', () => {
|
|
|
6225
6233
|
await waitFor(() => rendered.getByText('Rendered Id: 2'))
|
|
6226
6234
|
expect(spy).toHaveBeenCalledTimes(1)
|
|
6227
6235
|
})
|
|
6236
|
+
it('should not cause an infinite render loop when using unstable callback ref', async () => {
|
|
6237
|
+
const key = queryKey()
|
|
6238
|
+
|
|
6239
|
+
function Test() {
|
|
6240
|
+
const [_, setRef] = React.useState<HTMLDivElement | null>()
|
|
6241
|
+
|
|
6242
|
+
const { data } = useQuery({
|
|
6243
|
+
queryKey: [key],
|
|
6244
|
+
queryFn: async () => {
|
|
6245
|
+
await sleep(5)
|
|
6246
|
+
return 'Works'
|
|
6247
|
+
},
|
|
6248
|
+
})
|
|
6249
|
+
|
|
6250
|
+
return <div ref={(value) => setRef(value)}>{data}</div>
|
|
6251
|
+
}
|
|
6252
|
+
|
|
6253
|
+
const rendered = renderWithClient(queryClient, <Test />)
|
|
6254
|
+
|
|
6255
|
+
await waitFor(() => rendered.getByText('Works'))
|
|
6256
|
+
})
|
|
6228
6257
|
})
|