From 79fa0538f9be6be7a0923b36e6ec1dfab77902df Mon Sep 17 00:00:00 2001 From: poignatov Date: Tue, 10 Mar 2026 16:17:03 +0300 Subject: [PATCH] =?UTF-8?q?6.6.4:=20=D0=9E=D1=87=D0=B8=D1=81=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=B7=D0=B0=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=20=D0=B6=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- VERSION | 2 +- play-life-web/package.json | 2 +- .../src/components/WishlistDetail.jsx | 44 ++++++++++++------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index e411592..b22e754 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.6.3 +6.6.4 diff --git a/play-life-web/package.json b/play-life-web/package.json index 33217ad..64353fc 100644 --- a/play-life-web/package.json +++ b/play-life-web/package.json @@ -1,6 +1,6 @@ { "name": "play-life-web", - "version": "6.6.3", + "version": "6.6.4", "type": "module", "scripts": { "dev": "vite", diff --git a/play-life-web/src/components/WishlistDetail.jsx b/play-life-web/src/components/WishlistDetail.jsx index f86d186..324c1c3 100644 --- a/play-life-web/src/components/WishlistDetail.jsx +++ b/play-life-web/src/components/WishlistDetail.jsx @@ -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) => {