6.18.4: Фикс загрузки товаров при создании доски
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m14s

This commit is contained in:
poignatov
2026-03-15 20:00:12 +03:00
parent a4dcc62a37
commit 1876595005
3 changed files with 8 additions and 12 deletions

View File

@@ -1 +1 @@
6.18.3 6.18.4

View File

@@ -1,6 +1,6 @@
{ {
"name": "play-life-web", "name": "play-life-web",
"version": "6.18.3", "version": "6.18.4",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -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) if (showLoading) setBoardsLoading(true)
try { try {
const res = await authFetch('/api/shopping/boards') 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 })) localStorage.setItem(BOARDS_CACHE_KEY, JSON.stringify({ boards: boardsList }))
} catch (err) {} } 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) { if (boardsList.length > 0) {
setSelectedBoardId(boardsList[0].id) setSelectedBoardId(boardsList[0].id)
} else { } else {
setSelectedBoardId(null) setSelectedBoardId(null)
} }
} else if (preferBoardId && preferBoardId !== selectedBoardId) {
setSelectedBoardId(preferBoardId)
} }
} }
} catch (err) { } catch (err) {
@@ -230,7 +233,7 @@ function ShoppingList({ onNavigate, refreshTrigger = 0, isActive = false, initia
// Начальная загрузка // Начальная загрузка
useEffect(() => { useEffect(() => {
const hasCache = hasBoardsCache() const hasCache = hasBoardsCache()
fetchBoards(!hasCache) fetchBoards(!hasCache, initialBoardId)
initialFetchDoneRef.current = true initialFetchDoneRef.current = true
}, []) }, [])
@@ -261,13 +264,6 @@ function ShoppingList({ onNavigate, refreshTrigger = 0, isActive = false, initia
} }
}, [refreshTrigger]) }, [refreshTrigger])
// initialBoardId
useEffect(() => {
if (initialBoardId) {
setSelectedBoardId(initialBoardId)
}
}, [initialBoardId])
// Синхронизация refs для диалогов // Синхронизация refs для диалогов
useEffect(() => { useEffect(() => {
selectedItemForDetailRef.current = selectedItemForDetail selectedItemForDetailRef.current = selectedItemForDetail