Merge pull request #19466 from weityang/fix-cannot-convert-undefined-or-null-to-object-error
fix[core-components] Fix cannot convert undefined or null to object error
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/core-components': patch
|
||||
---
|
||||
|
||||
Fixed an issue causing `StructuredMetadataTable` to crash in case metadata contained `null` values.
|
||||
+1
-1
@@ -21,7 +21,7 @@ import { StructuredMetadataTable } from './StructuredMetadataTable';
|
||||
|
||||
describe('<StructuredMetadataTable />', () => {
|
||||
it('renders without exploding', () => {
|
||||
const metadata = { hello: 'world' };
|
||||
const metadata = { hello: 'world', foo: null };
|
||||
const { getByText } = render(
|
||||
<StructuredMetadataTable metadata={metadata} />,
|
||||
);
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ function toValue(
|
||||
return <Fragment>{value}</Fragment>;
|
||||
}
|
||||
|
||||
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
||||
return renderMap(value, options, nested);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user