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