@tanstack/react-query-devtools 4.8.0 → 4.10.0

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/react-query-devtools",
3
- "version": "4.8.0",
3
+ "version": "4.10.0",
4
4
  "description": "TODO",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -40,7 +40,8 @@
40
40
  "devDependencies": {
41
41
  "@types/use-sync-external-store": "^0.0.3",
42
42
  "react-error-boundary": "^3.1.4",
43
- "@tanstack/react-query": "4.8.0"
43
+ "@tanstack/react-query": "4.10.0",
44
+ "superjson": "^1.10.0"
44
45
  },
45
46
  "dependencies": {
46
47
  "@tanstack/match-sorter-utils": "^8.1.1",
@@ -49,7 +50,7 @@
49
50
  "peerDependencies": {
50
51
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
51
52
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
52
- "@tanstack/react-query": "4.8.0"
53
+ "@tanstack/react-query": "4.10.0"
53
54
  },
54
55
  "scripts": {
55
56
  "clean": "rm -rf ./build",
@@ -1,5 +1,5 @@
1
- import * as React from 'react'
2
1
  import { fireEvent, render, screen } from '@testing-library/react'
2
+ import * as React from 'react'
3
3
 
4
4
  import { chunkArray, DefaultRenderer } from '../Explorer'
5
5
  import { displayValue } from '../utils'
@@ -62,7 +62,19 @@ describe('Explorer', () => {
62
62
  })
63
63
 
64
64
  it('when the value is a BigInt', () => {
65
- expect(displayValue(BigInt(1))).toBe('"1n"')
65
+ expect(displayValue(BigInt(1))).toBe('"1"')
66
+ })
67
+
68
+ it('when the value is an Error', () => {
69
+ expect(displayValue(new Error('err'))).toBe(
70
+ '{"name":"Error","message":"err"}',
71
+ )
72
+ })
73
+
74
+ it('when the value is an object', () => {
75
+ expect(displayValue({ error: new Error('err'), bigint: 1n })).toBe(
76
+ '{"error":{"name":"Error","message":"err"},"bigint":"1"}',
77
+ )
66
78
  })
67
79
  })
68
80
  })
package/src/utils.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react'
2
2
  import type { Query } from '@tanstack/react-query'
3
+ import SuperJSON from 'superjson'
3
4
 
4
5
  import type { Theme } from './theme'
5
6
  import { useTheme } from './theme'
@@ -118,10 +119,9 @@ export function useIsMounted() {
118
119
  * @param {unknown} value Value to be stringified
119
120
  */
120
121
  export const displayValue = (value: unknown) => {
121
- const name = Object.getOwnPropertyNames(Object(value))
122
- const newValue = typeof value === 'bigint' ? `${value.toString()}n` : value
122
+ const { json } = SuperJSON.serialize(value)
123
123
 
124
- return JSON.stringify(newValue, name)
124
+ return JSON.stringify(json)
125
125
  }
126
126
 
127
127
  const getStatusRank = (q: Query) =>