Skip to content

Commit

Permalink
fix: don't crash if component is missing after referenced in category
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Apr 1, 2024
1 parent 3f7fc52 commit dc93789
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/core/lib/use-component-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export const useComponentList = (config: Config, ui: UiState) => {
>
{category.components.map((componentName, i) => {
matchedComponents.push(componentName as string);

const componentConf = config.components[componentName] || {};

return (
<ComponentList.Item
key={componentName}
label={
(config.components[componentName]["label"] ??
componentName) as string
}
label={(componentConf["label"] ?? componentName) as string}
name={componentName as string}
index={i}
/>
Expand All @@ -58,14 +58,13 @@ export const useComponentList = (config: Config, ui: UiState) => {
title={ui.componentList.other?.title || "Other"}
>
{remainingComponents.map((componentName, i) => {
const componentConf = config.components[componentName] || {};

return (
<ComponentList.Item
key={componentName}
name={componentName as string}
label={
(config.components[componentName]["label"] ??
componentName) as string
}
label={(componentConf["label"] ?? componentName) as string}
index={i}
/>
);
Expand Down

0 comments on commit dc93789

Please sign in to comment.