From c11830551c653c82b6bf341ad68a0c82bb03834b Mon Sep 17 00:00:00 2001 From: Nevo David Date: Wed, 3 Sep 2025 16:52:22 +0700 Subject: [PATCH] feat: fix append --- apps/frontend/src/components/new-launch/store.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/components/new-launch/store.ts b/apps/frontend/src/components/new-launch/store.ts index 754c833d..d7b03718 100644 --- a/apps/frontend/src/components/new-launch/store.ts +++ b/apps/frontend/src/components/new-launch/store.ts @@ -11,7 +11,7 @@ import { newDayjs } from '@gitroom/frontend/components/layout/set.timezone'; interface Values { id: string; content: string; - media: { id: string; path: string, thumbnail?: string }[]; + media: { id: string; path: string; thumbnail?: string }[]; } interface Internal { @@ -504,7 +504,9 @@ export const useLaunchStore = create()((set) => ({ ? { ...item, integrationValue: item.integrationValue.map((v, i) => - i === index ? { ...v, media: [...v.media, ...media] } : v + i === index + ? { ...v, media: [...(v?.media || []), ...media] } + : v ), } : item @@ -516,7 +518,9 @@ export const useLaunchStore = create()((set) => ({ ) => set((state) => ({ global: state.global.map((item, i) => - i === index ? { ...item, media: [...item.media, ...media] } : item + i === index + ? { ...item, media: [...(item?.media || []), ...media] } + : item ), })), setPostComment: (postComment: PostComment) =>