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",
|
"name": "play-life-web",
|
||||||
"version": "6.6.3",
|
"version": "6.6.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -75,10 +75,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
|||||||
if (onRefresh) {
|
if (onRefresh) {
|
||||||
onRefresh()
|
onRefresh()
|
||||||
}
|
}
|
||||||
if (onNavigate) {
|
closeWithHistoryCleanup()
|
||||||
onNavigate('wishlist')
|
|
||||||
}
|
|
||||||
onClose?.()
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error completing wishlist:', err)
|
console.error('Error completing wishlist:', err)
|
||||||
setToastMessage({ text: err.message || 'Ошибка при завершении', type: 'error' })
|
setToastMessage({ text: err.message || 'Ошибка при завершении', type: 'error' })
|
||||||
@@ -103,10 +100,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
|||||||
if (onRefresh) {
|
if (onRefresh) {
|
||||||
onRefresh()
|
onRefresh()
|
||||||
}
|
}
|
||||||
if (onNavigate) {
|
closeWithHistoryCleanup()
|
||||||
onNavigate('wishlist')
|
|
||||||
}
|
|
||||||
onClose?.()
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error rejecting wishlist:', err)
|
console.error('Error rejecting wishlist:', err)
|
||||||
setToastMessage({ text: err.message || 'Ошибка при отклонении', type: 'error' })
|
setToastMessage({ text: err.message || 'Ошибка при отклонении', type: 'error' })
|
||||||
@@ -131,8 +125,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
|||||||
if (onRefresh) {
|
if (onRefresh) {
|
||||||
onRefresh()
|
onRefresh()
|
||||||
}
|
}
|
||||||
fetchWishlistDetail()
|
closeWithHistoryCleanup()
|
||||||
onClose?.()
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error uncompleting wishlist:', err)
|
console.error('Error uncompleting wishlist:', err)
|
||||||
setToastMessage({ text: err.message || 'Ошибка при возобновлении желания', type: 'error' })
|
setToastMessage({ text: err.message || 'Ошибка при возобновлении желания', type: 'error' })
|
||||||
@@ -161,9 +154,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
|||||||
if (onRefresh) {
|
if (onRefresh) {
|
||||||
onRefresh()
|
onRefresh()
|
||||||
}
|
}
|
||||||
if (onNavigate) {
|
closeWithHistoryCleanup()
|
||||||
onNavigate('wishlist')
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error deleting wishlist:', err)
|
console.error('Error deleting wishlist:', err)
|
||||||
setToastMessage({ text: err.message || 'Ошибка при удалении', type: 'error' })
|
setToastMessage({ text: err.message || 'Ошибка при удалении', type: 'error' })
|
||||||
@@ -341,6 +332,28 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
|||||||
}
|
}
|
||||||
}, [wishlistId, selectedTaskForDetail, onClose, onNavigate, previousTab, boardId])
|
}, [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 = () => {
|
const handleClose = () => {
|
||||||
// Если была добавлена запись в историю, удаляем её через history.back()
|
// Если была добавлена запись в историю, удаляем её через history.back()
|
||||||
// Обработчик popstate закроет модальное окно
|
// Обработчик popstate закроет модальное окно
|
||||||
@@ -371,10 +384,7 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
|||||||
if (onRefresh) {
|
if (onRefresh) {
|
||||||
onRefresh()
|
onRefresh()
|
||||||
}
|
}
|
||||||
if (onNavigate) {
|
closeWithHistoryCleanup()
|
||||||
onNavigate('wishlist')
|
|
||||||
}
|
|
||||||
onClose?.()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDeleteTask = async (e) => {
|
const handleDeleteTask = async (e) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user