@tanstack/solid-query 5.0.0-beta.29 → 5.0.0-beta.35
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.35",
|
|
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-beta.
|
|
51
|
+
"@tanstack/query-core": "5.0.0-beta.35"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"tsup-preset-solid": "^2.0.1",
|
|
@@ -1511,98 +1511,6 @@ describe('createQuery', () => {
|
|
|
1511
1511
|
})
|
|
1512
1512
|
})
|
|
1513
1513
|
|
|
1514
|
-
it('should keep the previous data on disabled query when placeholderData is set to identity function', async () => {
|
|
1515
|
-
const key = queryKey()
|
|
1516
|
-
const states: Array<CreateQueryResult<number>> = []
|
|
1517
|
-
|
|
1518
|
-
function Page() {
|
|
1519
|
-
const [count, setCount] = createSignal(0)
|
|
1520
|
-
|
|
1521
|
-
const state = createQuery(() => ({
|
|
1522
|
-
queryKey: [key, count()],
|
|
1523
|
-
queryFn: async () => {
|
|
1524
|
-
await sleep(10)
|
|
1525
|
-
return count()
|
|
1526
|
-
},
|
|
1527
|
-
enabled: false,
|
|
1528
|
-
placeholderData: keepPreviousData,
|
|
1529
|
-
notifyOnChangeProps: 'all',
|
|
1530
|
-
}))
|
|
1531
|
-
|
|
1532
|
-
createRenderEffect(() => {
|
|
1533
|
-
states.push({ ...state })
|
|
1534
|
-
})
|
|
1535
|
-
|
|
1536
|
-
createEffect(() => {
|
|
1537
|
-
const refetch = state.refetch
|
|
1538
|
-
refetch()
|
|
1539
|
-
|
|
1540
|
-
setActTimeout(() => {
|
|
1541
|
-
setCount(1)
|
|
1542
|
-
}, 20)
|
|
1543
|
-
|
|
1544
|
-
setActTimeout(() => {
|
|
1545
|
-
refetch()
|
|
1546
|
-
}, 30)
|
|
1547
|
-
})
|
|
1548
|
-
|
|
1549
|
-
return null
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
render(() => (
|
|
1553
|
-
<QueryClientProvider client={queryClient}>
|
|
1554
|
-
<Page />
|
|
1555
|
-
</QueryClientProvider>
|
|
1556
|
-
))
|
|
1557
|
-
|
|
1558
|
-
await sleep(100)
|
|
1559
|
-
|
|
1560
|
-
expect(states.length).toBe(6)
|
|
1561
|
-
|
|
1562
|
-
// Disabled query
|
|
1563
|
-
expect(states[0]).toMatchObject({
|
|
1564
|
-
data: undefined,
|
|
1565
|
-
isFetching: false,
|
|
1566
|
-
isSuccess: false,
|
|
1567
|
-
isPlaceholderData: false,
|
|
1568
|
-
})
|
|
1569
|
-
// Fetching query
|
|
1570
|
-
expect(states[1]).toMatchObject({
|
|
1571
|
-
data: undefined,
|
|
1572
|
-
isFetching: true,
|
|
1573
|
-
isSuccess: false,
|
|
1574
|
-
isPlaceholderData: false,
|
|
1575
|
-
})
|
|
1576
|
-
// Fetched query
|
|
1577
|
-
expect(states[2]).toMatchObject({
|
|
1578
|
-
data: 0,
|
|
1579
|
-
isFetching: false,
|
|
1580
|
-
isSuccess: true,
|
|
1581
|
-
isPlaceholderData: false,
|
|
1582
|
-
})
|
|
1583
|
-
// Set state
|
|
1584
|
-
expect(states[3]).toMatchObject({
|
|
1585
|
-
data: 0,
|
|
1586
|
-
isFetching: false,
|
|
1587
|
-
isSuccess: true,
|
|
1588
|
-
isPlaceholderData: true,
|
|
1589
|
-
})
|
|
1590
|
-
// Fetching new query
|
|
1591
|
-
expect(states[4]).toMatchObject({
|
|
1592
|
-
data: 0,
|
|
1593
|
-
isFetching: true,
|
|
1594
|
-
isSuccess: true,
|
|
1595
|
-
isPlaceholderData: true,
|
|
1596
|
-
})
|
|
1597
|
-
// Fetched new query
|
|
1598
|
-
expect(states[5]).toMatchObject({
|
|
1599
|
-
data: 1,
|
|
1600
|
-
isFetching: false,
|
|
1601
|
-
isSuccess: true,
|
|
1602
|
-
isPlaceholderData: false,
|
|
1603
|
-
})
|
|
1604
|
-
})
|
|
1605
|
-
|
|
1606
1514
|
it('should keep the previous data on disabled query when placeholderData is set and switching query key multiple times', async () => {
|
|
1607
1515
|
const key = queryKey()
|
|
1608
1516
|
const states: Array<CreateQueryResult<number>> = []
|