6.18.4: Фикс загрузки товаров при создании доски
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m14s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m14s
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user