From 237faddb40559103f0bf1d5bd9055cf2c6e7cb29 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Fri, 15 Sep 2023 04:05:43 -0700 Subject: [PATCH] Fix crash for bloks sidebar Summary: Bloks ios is serializing some ns dictionary without registering the metadata, this means the look up fails. That said regsitering metadata for dictionarys where the keyspace is unbounded doesnt make any sense so for this case we can just fall back to the key as the name. Since we can rely on the id lookup passing we iterarates the enties of the object Reviewed By: passy, ivanmisuno Differential Revision: D49314398 fbshipit-source-id: 65f7beb0d8402b08a68b9f00b7605e0b6c44766f --- .../components/sidebar/inspector/AttributesInspector.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/desktop/plugins/public/ui-debugger/components/sidebar/inspector/AttributesInspector.tsx b/desktop/plugins/public/ui-debugger/components/sidebar/inspector/AttributesInspector.tsx index 0e2346e93..33270e383 100644 --- a/desktop/plugins/public/ui-debugger/components/sidebar/inspector/AttributesInspector.tsx +++ b/desktop/plugins/public/ui-debugger/components/sidebar/inspector/AttributesInspector.tsx @@ -72,17 +72,16 @@ const ObjectAttributeInspector: React.FC<{ return (
{name} - {Object.keys(fields).map(function (key, _) { + {Object.entries(fields).map(([key, value]) => { const metadataId: number = Number(key); - const inspectableValue = fields[metadataId]; - const attributeName = metadata.get(metadataId)?.name ?? ''; + const attributeName = metadata.get(metadataId)?.name ?? key; return ( - {create(metadata, attributeName, inspectableValue, level + 5)} + {create(metadata, attributeName, value, level + 5)} ); })} @@ -122,7 +121,7 @@ function create( inspectable: Inspectable, level: number = 2, ) { - switch (inspectable.type) { + switch (inspectable?.type) { case 'boolean': return (