diff --git a/packages/form-devtools/src/components/DetailsPanel.tsx b/packages/form-devtools/src/components/DetailsPanel.tsx index bbf7659a3..f72bcf225 100644 --- a/packages/form-devtools/src/components/DetailsPanel.tsx +++ b/packages/form-devtools/src/components/DetailsPanel.tsx @@ -7,6 +7,25 @@ import { StateHeader } from './StateHeader' import type { Accessor } from 'solid-js' +const preprocessValue = (value: any): any => { + if (typeof value === 'number' && isNaN(value)) { + return 'NaN' + } + if (Array.isArray(value)) { + return value.map(preprocessValue) + } + if (value !== null && typeof value === 'object') { + const result: any = {} + for (const key in value) { + if (value.hasOwnProperty(key)) { + result[key] = preprocessValue(value[key]) + } + } + return result + } + return value +} + type DetailsPanelProps = { selectedKey: Accessor } @@ -86,7 +105,7 @@ export function DetailsPanel({ selectedKey }: DetailsPanelProps) { > {fieldName} - + )} @@ -98,7 +117,7 @@ export function DetailsPanel({ selectedKey }: DetailsPanelProps) {
@@ -106,7 +125,7 @@ export function DetailsPanel({ selectedKey }: DetailsPanelProps) {
Form status
- +
@@ -115,7 +134,7 @@ export function DetailsPanel({ selectedKey }: DetailsPanelProps) {
@@ -126,7 +145,7 @@ export function DetailsPanel({ selectedKey }: DetailsPanelProps) {