fix(devtools): don't round decimal vals previews in the state serializer

The actual numerical data can only be checked in the prop edit mode. This fixes that and makes the real value visible all the time.
This commit is contained in:
hawkgs
2025-11-17 15:29:49 +02:00
committed by Jessica Janiuk
parent 7d41716703
commit d6be289603
2 changed files with 18 additions and 1 deletions
@@ -60,7 +60,7 @@ const typeToDescriptorPreview: Formatter<string> = {
[PropType.Function]: (prop: Function) => `${prop.name}(...)`,
[PropType.HTMLNode]: (prop: Node) => prop.constructor.name,
[PropType.Null]: (_: null) => 'null',
[PropType.Number]: (prop: any) => parseInt(prop, 10).toString(),
[PropType.Number]: (prop: any) => prop.toString(),
[PropType.Object]: (prop: Object) => (getKeys(prop).length > 0 ? '{...}' : '{}'),
[PropType.Symbol]: (symbol: symbol) => `Symbol(${symbol.description})`,
[PropType.Undefined]: (_: undefined) => 'undefined',
@@ -51,6 +51,7 @@ const QUERY_1_2 = [
const dir1 = {
one: 1,
pi: 3.14159,
nested: {
arr: [
{
@@ -95,6 +96,14 @@ describe('deeplySerializeSelectedProperties', () => {
value: 1,
containerType: null,
},
pi: {
type: PropType.Number,
expandable: false,
editable: true,
preview: '3.14159',
value: 3.14159,
containerType: null,
},
nested: {
type: PropType.Object,
editable: false,
@@ -125,6 +134,14 @@ describe('deeplySerializeSelectedProperties', () => {
value: 1,
containerType: null,
},
pi: {
type: PropType.Number,
expandable: false,
editable: true,
preview: '3.14159',
value: 3.14159,
containerType: null,
},
nested: {
type: PropType.Object,
editable: false,