@tanstack/solid-query 5.0.0-beta.14 → 5.0.0-beta.17

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.14",
3
+ "version": "5.0.0-beta.17",
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.14"
51
+ "@tanstack/query-core": "5.0.0-beta.15"
52
52
  },
53
53
  "devDependencies": {
54
54
  "tsup-preset-solid": "^2.0.1",
@@ -64,6 +64,10 @@ describe('createMutation', () => {
64
64
  })
65
65
 
66
66
  it('should be able to reset `error`', async () => {
67
+ const consoleMock = vi
68
+ .spyOn(console, 'error')
69
+ .mockImplementation(() => undefined)
70
+
67
71
  function Page() {
68
72
  const mutation = createMutation<string, Error>(() => ({
69
73
  mutationFn: () => {
@@ -105,6 +109,8 @@ describe('createMutation', () => {
105
109
  await waitFor(() => {
106
110
  expect(screen.queryByRole('heading')).toBeNull()
107
111
  })
112
+
113
+ consoleMock.mockRestore()
108
114
  })
109
115
 
110
116
  it('should be able to call `onSuccess` and `onSettled` after each successful mutate', async () => {
@@ -781,6 +787,10 @@ describe('createMutation', () => {
781
787
  })
782
788
 
783
789
  it('should be able to throw an error when throwOnError is set to true', async () => {
790
+ const consoleMock = vi
791
+ .spyOn(console, 'error')
792
+ .mockImplementation(() => undefined)
793
+
784
794
  function Page() {
785
795
  const mutation = createMutation<string, Error>(() => ({
786
796
  mutationFn: () => {
@@ -817,9 +827,15 @@ describe('createMutation', () => {
817
827
  await waitFor(() => {
818
828
  expect(screen.queryByText('error')).not.toBeNull()
819
829
  })
830
+
831
+ consoleMock.mockRestore()
820
832
  })
821
833
 
822
834
  it('should be able to throw an error when throwOnError is a function that returns true', async () => {
835
+ const consoleMock = vi
836
+ .spyOn(console, 'error')
837
+ .mockImplementation(() => undefined)
838
+
823
839
  let boundary = false
824
840
  function Page() {
825
841
  const mutation = createMutation<string, Error>(() => ({
@@ -867,6 +883,8 @@ describe('createMutation', () => {
867
883
  await waitFor(() => {
868
884
  expect(screen.queryByText('error boundary')).not.toBeNull()
869
885
  })
886
+
887
+ consoleMock.mockRestore()
870
888
  })
871
889
 
872
890
  it('should pass meta to mutation', async () => {
@@ -2446,6 +2446,10 @@ describe('createQuery', () => {
2446
2446
  it('should set status to error if queryFn throws', async () => {
2447
2447
  const key = queryKey()
2448
2448
 
2449
+ const consoleMock = vi
2450
+ .spyOn(console, 'error')
2451
+ .mockImplementation(() => undefined)
2452
+
2449
2453
  function Page() {
2450
2454
  const state = createQuery(() => ({
2451
2455
  queryKey: key,
@@ -2471,11 +2475,17 @@ describe('createQuery', () => {
2471
2475
 
2472
2476
  await waitFor(() => screen.getByText('error'))
2473
2477
  await waitFor(() => screen.getByText('Error test jaylen'))
2478
+
2479
+ consoleMock.mockRestore()
2474
2480
  })
2475
2481
 
2476
2482
  it('should throw error if queryFn throws and throwOnError is in use', async () => {
2477
2483
  const key = queryKey()
2478
2484
 
2485
+ const consoleMock = vi
2486
+ .spyOn(console, 'error')
2487
+ .mockImplementation(() => undefined)
2488
+
2479
2489
  function Page() {
2480
2490
  const state = createQuery(() => ({
2481
2491
  queryKey: key,
@@ -2501,6 +2511,8 @@ describe('createQuery', () => {
2501
2511
  ))
2502
2512
 
2503
2513
  await waitFor(() => screen.getByText('error boundary'))
2514
+
2515
+ consoleMock.mockRestore()
2504
2516
  })
2505
2517
 
2506
2518
  it('should update with data if we observe no properties and throwOnError', async () => {
@@ -453,6 +453,10 @@ describe("useQuery's in Suspense mode", () => {
453
453
  it('should throw errors to the error boundary by default', async () => {
454
454
  const key = queryKey()
455
455
 
456
+ const consoleMock = vi
457
+ .spyOn(console, 'error')
458
+ .mockImplementation(() => undefined)
459
+
456
460
  function Page() {
457
461
  const state = createQuery(() => ({
458
462
  queryKey: key,
@@ -497,6 +501,8 @@ describe("useQuery's in Suspense mode", () => {
497
501
 
498
502
  await waitFor(() => screen.getByText('Loading...'))
499
503
  await waitFor(() => screen.getByText('error boundary'))
504
+
505
+ consoleMock.mockRestore()
500
506
  })
501
507
 
502
508
  it('should not throw errors to the error boundary when throwOnError: false', async () => {
@@ -551,6 +557,10 @@ describe("useQuery's in Suspense mode", () => {
551
557
  it('should throw errors to the error boundary when a throwOnError function returns true', async () => {
552
558
  const key = queryKey()
553
559
 
560
+ const consoleMock = vi
561
+ .spyOn(console, 'error')
562
+ .mockImplementation(() => undefined)
563
+
554
564
  function Page() {
555
565
  const state = createQuery(() => ({
556
566
  queryKey: key,
@@ -595,6 +605,8 @@ describe("useQuery's in Suspense mode", () => {
595
605
 
596
606
  await waitFor(() => screen.getByText('Loading...'))
597
607
  await waitFor(() => screen.getByText('error boundary'))
608
+
609
+ consoleMock.mockRestore()
598
610
  })
599
611
 
600
612
  it('should not throw errors to the error boundary when a throwOnError function returns false', async () => {
@@ -696,6 +708,10 @@ describe("useQuery's in Suspense mode", () => {
696
708
  it('should error catched in error boundary without infinite loop', async () => {
697
709
  const key = queryKey()
698
710
 
711
+ const consoleMock = vi
712
+ .spyOn(console, 'error')
713
+ .mockImplementation(() => undefined)
714
+
699
715
  let succeed = true
700
716
 
701
717
  function Page() {
@@ -756,11 +772,17 @@ describe("useQuery's in Suspense mode", () => {
756
772
  fireEvent.click(screen.getByLabelText('fail'))
757
773
  // render error boundary fallback (error boundary)
758
774
  await waitFor(() => screen.getByText('error boundary'))
775
+
776
+ consoleMock.mockRestore()
759
777
  })
760
778
 
761
779
  it('should error catched in error boundary without infinite loop when query keys changed', async () => {
762
780
  let succeed = true
763
781
 
782
+ const consoleMock = vi
783
+ .spyOn(console, 'error')
784
+ .mockImplementation(() => undefined)
785
+
764
786
  function Page() {
765
787
  const [key, setKey] = createSignal(0)
766
788
 
@@ -814,9 +836,15 @@ describe("useQuery's in Suspense mode", () => {
814
836
  fireEvent.click(screen.getByLabelText('fail'))
815
837
  // render error boundary fallback (error boundary)
816
838
  await waitFor(() => screen.getByText('error boundary'))
839
+
840
+ consoleMock.mockRestore()
817
841
  })
818
842
 
819
843
  it('should error catched in error boundary without infinite loop when enabled changed', async () => {
844
+ const consoleMock = vi
845
+ .spyOn(console, 'error')
846
+ .mockImplementation(() => undefined)
847
+
820
848
  function Page() {
821
849
  const queryKeys = '1'
822
850
  const [enabled, setEnabled] = createSignal(false)
@@ -874,6 +902,8 @@ describe("useQuery's in Suspense mode", () => {
874
902
 
875
903
  // render error boundary fallback (error boundary)
876
904
  await waitFor(() => screen.getByText('error boundary'))
905
+
906
+ consoleMock.mockRestore()
877
907
  })
878
908
 
879
909
  it('should render the correct amount of times in Suspense mode when gcTime is set to 0', async () => {