Clearer section creation
Summary: A bit more explicit with the intent, clearer code. Reviewed By: ivanmisuno Differential Revision: D43186540 fbshipit-source-id: 24f2168f5be91673683966208c9b8b54125aaa5b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6316852026
commit
ca602bffd0
@@ -258,17 +258,25 @@ export const AttributesInspector: React.FC<Props> = ({
|
|||||||
const keys = Object.keys(node.attributes);
|
const keys = Object.keys(node.attributes);
|
||||||
const sections = keys
|
const sections = keys
|
||||||
.map(function (key, _) {
|
.map(function (key, _) {
|
||||||
const metadataId: number = Number(key);
|
|
||||||
/**
|
/**
|
||||||
* The node top-level attributes refer to the displayable panels.
|
* The node top-level attributes refer to the displayable panels.
|
||||||
* The panel name is obtained by querying the metadata.
|
* The panel name is obtained by querying the metadata.
|
||||||
* The inspectable contains the actual attributes belonging to each panel.
|
* The inspectable contains the actual attributes belonging to each panel.
|
||||||
*/
|
*/
|
||||||
|
const metadataId: number = Number(key);
|
||||||
|
const sectionMetadata = metadata.get(metadataId);
|
||||||
|
if (!sectionMetadata) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const sectionAttributes = node.attributes[
|
||||||
|
metadataId
|
||||||
|
] as InspectableObject;
|
||||||
|
|
||||||
return createSection(
|
return createSection(
|
||||||
mode,
|
mode,
|
||||||
metadata,
|
metadata,
|
||||||
metadata.get(metadataId)?.name ?? '',
|
sectionMetadata.name,
|
||||||
node.attributes[metadataId] as InspectableObject,
|
sectionAttributes,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.filter((section) => section !== undefined);
|
.filter((section) => section !== undefined);
|
||||||
|
|||||||
Reference in New Issue
Block a user