From 7539926fa1a52f74a8c8e413fb9b088d15e24eec Mon Sep 17 00:00:00 2001 From: Pascal Kuppler <75665115+pascal260303@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:30:38 +0100 Subject: [PATCH] Fix bug when robot name is null (#184) There was a bug in the frontend that happened when the robot name is not included in a file in the backend and became `null` in the frontend. This resulted in the following error messages when opening the detail view: In production: ![grafik](https://github.com/user-attachments/assets/36063371-1ef7-4228-a907-afd49e384cdd) In development: ![grafik](https://github.com/user-attachments/assets/a8497b7c-bd1c-4d38-ba5e-bd79f98f9e86) This fixes that bug. --- frontend/app/pages/details/DetailsView.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/app/pages/details/DetailsView.tsx b/frontend/app/pages/details/DetailsView.tsx index 70453b1c..f4a8467a 100644 --- a/frontend/app/pages/details/DetailsView.tsx +++ b/frontend/app/pages/details/DetailsView.tsx @@ -17,6 +17,9 @@ function formatRobotNames(robotNames: string[] | undefined | null): string { // Create a Set to track normalized names and filter duplicates const seen = new Set(); const uniqueRobots = robotNames.filter((name) => { + if (!name) { + return false; + } const normalizedName = name.toLowerCase(); if (seen.has(normalizedName)) { return false; @@ -55,7 +58,9 @@ const DetailsView: React.FC = ({ return ( {/* Main content */}