fix: Исправлен порядок вызова React hooks в CalculatorNav
This commit is contained in:
parent
5e88427368
commit
186c85738d
@ -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}` : '';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user