From 186c85738d8d13d68faba35773ca5528dbdbbbfd Mon Sep 17 00:00:00 2001 From: dosai Date: Sat, 1 Nov 2025 20:23:31 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0=20React=20hooks=20?= =?UTF-8?q?=D0=B2=20CalculatorNav?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/components/CalculatorNav.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/components/CalculatorNav.tsx b/frontend/components/CalculatorNav.tsx index 000acee..003e612 100644 --- a/frontend/components/CalculatorNav.tsx +++ b/frontend/components/CalculatorNav.tsx @@ -19,11 +19,17 @@ export default function CalculatorNav() { if (typeof window !== 'undefined') { const params = new URLSearchParams(window.location.search); const id = params.get('chat_id'); - if (id) { + if (id && id !== chatId) { setChatId(id); + } else if (!id) { + // Пробуем восстановить из sessionStorage + const savedChatId = sessionStorage.getItem('chat_id'); + if (savedChatId && savedChatId !== chatId) { + setChatId(savedChatId); + } } } - }, [pathname]); + }, [pathname, chatId]); // Сохраняем chat_id при переходах const queryString = chatId ? `?chat_id=${chatId}` : '';