Исправления формы желаний, очистка кода
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 46s

This commit is contained in:
poignatov
2026-01-13 16:52:08 +03:00
parent a54c9983d4
commit 0e53dfbdf7
5 changed files with 27 additions and 17 deletions

View File

@@ -1 +1 @@
3.10.2
3.10.3

View File

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

View File

@@ -668,6 +668,7 @@ function AppContent() {
}
// Обновляем список желаний при возврате из экрана редактирования
if (activeTab === 'wishlist-form' && tab === 'wishlist') {
setTabParams({}) // Очищаем параметры при закрытии формы
setWishlistRefreshTrigger(prev => prev + 1)
}
// Загрузка данных произойдет в useEffect при изменении activeTab

View File

@@ -484,19 +484,6 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, error, onRetry
// Одноразовая задача: когда оба поля null/undefined
const isOneTime = (task.repetition_period == null || task.repetition_period === undefined) &&
(task.repetition_date == null || task.repetition_date === undefined)
// Отладка для задачи "Ролик"
if (task.name === 'Ролик') {
console.log('Task "Ролик":', {
name: task.name,
repetition_period: task.repetition_period,
repetition_date: task.repetition_date,
next_show_at: task.next_show_at,
hasZeroPeriod,
hasZeroDate,
isInfinite
})
}
return (
<div

View File

@@ -65,24 +65,44 @@ function WishlistForm({ onNavigate, wishlistId, editConditionIndex }) {
}
}, [wishlistId, tasks, projects])
// Сброс формы при размонтировании компонента
// Сброс формы при размонтировании компонента или при изменении wishlistId на undefined
useEffect(() => {
return () => {
resetForm()
}
}, [])
}, [wishlistId])
// Открываем форму редактирования условия, если передан editConditionIndex
useEffect(() => {
if (editConditionIndex !== undefined && editConditionIndex !== null && unlockConditions.length > editConditionIndex) {
setEditingConditionIndex(editConditionIndex)
setShowConditionForm(true)
} else if (editConditionIndex === undefined || editConditionIndex === null) {
// Закрываем форму условия, если editConditionIndex сброшен
setEditingConditionIndex(null)
setShowConditionForm(false)
}
}, [editConditionIndex, unlockConditions])
const loadWishlist = async () => {
setLoadingWishlist(true)
try {
// Сначала очищаем форму, чтобы удалить старые данные
setName('')
setPrice('')
setLink('')
setImageUrl(null)
setImageFile(null)
setUnlockConditions([])
setError('')
setShowCropper(false)
setCrop({ x: 0, y: 0 })
setZoom(1)
setCroppedAreaPixels(null)
setShowConditionForm(false)
setEditingConditionIndex(null)
setToastMessage(null)
const response = await authFetch(`${API_URL}/${wishlistId}`)
if (!response.ok) {
throw new Error('Ошибка загрузки желания')
@@ -102,6 +122,8 @@ function WishlistForm({ onNavigate, wishlistId, editConditionIndex }) {
start_date: cond.start_date || null,
display_order: idx,
})))
} else {
setUnlockConditions([])
}
} catch (err) {
setError(err.message)