Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/react-query-devtools/src/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
getResizeHandleStyle,
getSidedProp,
defaultPanelSize,
displayValue,
} from './utils'
import type { Corner, Side } from './utils'
import {
Expand Down Expand Up @@ -846,7 +847,7 @@ const ActiveQuery = ({
overflow: 'auto',
}}
>
{JSON.stringify(activeQuery.queryKey, null, 2)}
{displayValue(activeQuery.queryKey, true)}
</pre>
</Code>
<span
Expand Down
5 changes: 3 additions & 2 deletions packages/react-query-devtools/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ export function useIsMounted() {
/**
* Displays a string regardless the type of the data
* @param {unknown} value Value to be stringified
* @param {boolean} beautify Formats json to multiline
*/
export const displayValue = (value: unknown) => {
export const displayValue = (value: unknown, beautify: boolean = false) => {
const { json } = SuperJSON.serialize(value)

return JSON.stringify(json)
return JSON.stringify(json, null, beautify ? 2 : undefined)
}

// Sorting functions
Expand Down