6.6.4: Очистка истории при закрытии диалога желания
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m3s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m3s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "play-life-web",
|
||||
"version": "6.6.3",
|
||||
"version": "6.6.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -75,10 +75,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
if (onRefresh) {
|
||||
onRefresh()
|
||||
}
|
||||
if (onNavigate) {
|
||||
onNavigate('wishlist')
|
||||
}
|
||||
onClose?.()
|
||||
closeWithHistoryCleanup()
|
||||
} catch (err) {
|
||||
console.error('Error completing wishlist:', err)
|
||||
setToastMessage({ text: err.message || 'Ошибка при завершении', type: 'error' })
|
||||
@@ -103,10 +100,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
if (onRefresh) {
|
||||
onRefresh()
|
||||
}
|
||||
if (onNavigate) {
|
||||
onNavigate('wishlist')
|
||||
}
|
||||
onClose?.()
|
||||
closeWithHistoryCleanup()
|
||||
} catch (err) {
|
||||
console.error('Error rejecting wishlist:', err)
|
||||
setToastMessage({ text: err.message || 'Ошибка при отклонении', type: 'error' })
|
||||
@@ -131,8 +125,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
if (onRefresh) {
|
||||
onRefresh()
|
||||
}
|
||||
fetchWishlistDetail()
|
||||
onClose?.()
|
||||
closeWithHistoryCleanup()
|
||||
} catch (err) {
|
||||
console.error('Error uncompleting wishlist:', err)
|
||||
setToastMessage({ text: err.message || 'Ошибка при возобновлении желания', type: 'error' })
|
||||
@@ -161,9 +154,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
if (onRefresh) {
|
||||
onRefresh()
|
||||
}
|
||||
if (onNavigate) {
|
||||
onNavigate('wishlist')
|
||||
}
|
||||
closeWithHistoryCleanup()
|
||||
} catch (err) {
|
||||
console.error('Error deleting wishlist:', err)
|
||||
setToastMessage({ text: err.message || 'Ошибка при удалении', type: 'error' })
|
||||
@@ -341,6 +332,28 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
}
|
||||
}, [wishlistId, selectedTaskForDetail, onClose, onNavigate, previousTab, boardId])
|
||||
|
||||
// Закрытие модального окна с очисткой записей из истории
|
||||
// Используется при программном закрытии (завершение, отклонение, возобновление)
|
||||
const closeWithHistoryCleanup = () => {
|
||||
// Считаем сколько записей нужно убрать из истории
|
||||
let stepsBack = 0
|
||||
if (historyPushedForTaskRef.current) stepsBack++
|
||||
if (historyPushedForWishlistRef.current) stepsBack++
|
||||
|
||||
// Сбрасываем refs чтобы popstate handler не реагировал
|
||||
historyPushedForTaskRef.current = false
|
||||
historyPushedForWishlistRef.current = false
|
||||
selectedTaskForDetailRef.current = null
|
||||
wishlistIdRef.current = null
|
||||
setSelectedTaskForDetail(null)
|
||||
|
||||
// Убираем записи из истории
|
||||
if (stepsBack > 0) {
|
||||
window.history.go(-stepsBack)
|
||||
}
|
||||
onClose?.()
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
// Если была добавлена запись в историю, удаляем её через history.back()
|
||||
// Обработчик popstate закроет модальное окно
|
||||
@@ -371,10 +384,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
||||
if (onRefresh) {
|
||||
onRefresh()
|
||||
}
|
||||
if (onNavigate) {
|
||||
onNavigate('wishlist')
|
||||
}
|
||||
onClose?.()
|
||||
closeWithHistoryCleanup()
|
||||
}
|
||||
|
||||
const handleDeleteTask = async (e) => {
|
||||
|
||||
Reference in New Issue
Block a user