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",
|
||||
"version": "6.18.3",
|
||||
"version": "6.18.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"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)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user