Skip to content

Commit

Permalink
fix: correctly find peripherals in Media component
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcur committed Feb 15, 2024
1 parent 6c57c0b commit d8c6849
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/scenes/kit/kit-data/Media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ export default function Media({ kit, configuration }: Props) {
</Table.Cell>
<Table.Cell>
{
configuration.peripherals[displayMedia.peripheralId]!
.name
configuration.peripherals.find(
(peripheral) =>
peripheral.id === displayMedia.peripheralId,
)?.name
}
</Table.Cell>
<Table.Cell>{displayMedia.name}</Table.Cell>
Expand All @@ -142,7 +144,9 @@ export default function Media({ kit, configuration }: Props) {
</Table.Header>
<Table.Body>
{mediaList.map((media) => {
const peripheral = configuration.peripherals[media.peripheralId]!;
const peripheral = configuration.peripherals.find(
(peripheral) => peripheral.id === media.peripheralId,
);
const displayable =
media.type === "image/png" ||
media.type === "image/jpeg" ||
Expand All @@ -152,6 +156,9 @@ export default function Media({ kit, configuration }: Props) {
displayMedia !== null &&
displayMedia.id === media.id &&
displayUrl === null;
if (peripheral === undefined) {
return;
}
return (
<Table.Row key={media.id}>
<Table.Cell>
Expand Down

0 comments on commit d8c6849

Please sign in to comment.