From e46cf6bfbdab1eae431ff6e772c33026129cc649 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Tue, 3 Feb 2026 19:03:34 +0300 Subject: [PATCH] Add UUID keys and guard avatar checks Check avatar existence before calling endsWith to avoid runtime errors. Use v4() for story item keys instead of the composite id/did/createdAt key. --- apps/web/src/pages/home/stories/Stories.tsx | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/web/src/pages/home/stories/Stories.tsx b/apps/web/src/pages/home/stories/Stories.tsx index 3f361d91..eda9d315 100644 --- a/apps/web/src/pages/home/stories/Stories.tsx +++ b/apps/web/src/pages/home/stories/Stories.tsx @@ -17,6 +17,7 @@ import { useStoriesQuery } from "../../../hooks/useStories"; import styles, { getModalStyles } from "./styles"; import _ from "lodash"; import ContentLoader from "react-content-loader"; +import { v4 } from "uuid"; dayjs.extend(relativeTime); dayjs.extend(utc); @@ -337,17 +338,17 @@ function Stories() { > {stories.map((item, index) => ( { setCurrentlyPlaying(item); setCurrentIndex(index); setIsOpen(true); }} > - {!item.avatar?.endsWith("/@jpeg") && ( + {item.avatar && !item.avatar.endsWith("/@jpeg") && ( )} - {item.avatar?.endsWith("/@jpeg") && ( + {item.avatar && item.avatar.endsWith("/@jpeg") && (
@@ -397,14 +398,16 @@ function Stories() {
- {!currentlyPlaying?.avatar?.endsWith("/@jpeg") && ( - - )} - {currentlyPlaying?.avatar?.endsWith("/@jpeg") && ( -
- -
- )} + {currentlyPlaying?.avatar && + !currentlyPlaying?.avatar?.endsWith("/@jpeg") && ( + + )} + {currentlyPlaying?.avatar && + currentlyPlaying.avatar.endsWith("/@jpeg") && ( +
+ +
+ )}
-- 2.51.2