From 18765950059f09cbbda4b9effafc380c15f2bc4b Mon Sep 17 00:00:00 2001 From: poignatov Date: Sun, 15 Mar 2026 20:00:12 +0300 Subject: [PATCH] =?UTF-8?q?6.18.4:=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=80=D0=BE=D0=B2=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=BE?= =?UTF-8?q?=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=B4=D0=BE=D1=81=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- play-life-web/package.json | 2 +- play-life-web/src/components/ShoppingList.jsx | 16 ++++++---------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/VERSION b/VERSION index 2e49270..9e36380 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.18.3 +6.18.4 diff --git a/play-life-web/package.json b/play-life-web/package.json index efc0896..66d6540 100644 --- a/play-life-web/package.json +++ b/play-life-web/package.json @@ -1,6 +1,6 @@ { "name": "play-life-web", - "version": "6.18.3", + "version": "6.18.4", "type": "module", "scripts": { "dev": "vite", diff --git a/play-life-web/src/components/ShoppingList.jsx b/play-life-web/src/components/ShoppingList.jsx index fe1cdb6..aca2797 100644 --- a/play-life-web/src/components/ShoppingList.jsx +++ b/play-life-web/src/components/ShoppingList.jsx @@ -153,7 +153,7 @@ function ShoppingList({ onNavigate, refreshTrigger = 0, isActive = false, initia } // Загрузка досок - const fetchBoards = async (showLoading = true) => { + const fetchBoards = async (showLoading = true, preferBoardId = null) => { if (showLoading) setBoardsLoading(true) try { const res = await authFetch('/api/shopping/boards') @@ -166,12 +166,15 @@ function ShoppingList({ onNavigate, refreshTrigger = 0, isActive = false, initia localStorage.setItem(BOARDS_CACHE_KEY, JSON.stringify({ boards: boardsList })) } catch (err) {} - if (boardDeleted || !boardsList.some(b => b.id === selectedBoardId)) { + const effectiveBoardId = preferBoardId || selectedBoardId + if (boardDeleted || !boardsList.some(b => b.id === effectiveBoardId)) { if (boardsList.length > 0) { setSelectedBoardId(boardsList[0].id) } else { setSelectedBoardId(null) } + } else if (preferBoardId && preferBoardId !== selectedBoardId) { + setSelectedBoardId(preferBoardId) } } } catch (err) { @@ -230,7 +233,7 @@ function ShoppingList({ onNavigate, refreshTrigger = 0, isActive = false, initia // Начальная загрузка useEffect(() => { const hasCache = hasBoardsCache() - fetchBoards(!hasCache) + fetchBoards(!hasCache, initialBoardId) initialFetchDoneRef.current = true }, []) @@ -261,13 +264,6 @@ function ShoppingList({ onNavigate, refreshTrigger = 0, isActive = false, initia } }, [refreshTrigger]) - // initialBoardId - useEffect(() => { - if (initialBoardId) { - setSelectedBoardId(initialBoardId) - } - }, [initialBoardId]) - // Синхронизация refs для диалогов useEffect(() => { selectedItemForDetailRef.current = selectedItemForDetail