UI: переход на history-router без # и короткие ссылки тредов

This commit is contained in:
AidarKC
2026-05-19 10:15:15 +03:00
parent 3a0899bcfe
commit db2d9a666b
9 changed files with 61 additions and 28 deletions
+5 -4
View File
@@ -289,7 +289,7 @@ function consumeCallPushActionFromUrlIfAny() {
params.delete('callPushAction');
params.delete('callPushPayload');
const nextQuery = params.toString();
const nextUrl = `${window.location.pathname}${nextQuery ? `?${nextQuery}` : ''}${window.location.hash || ''}`;
const nextUrl = `${window.location.pathname}${nextQuery ? `?${nextQuery}` : ''}`;
window.history.replaceState({}, '', nextUrl);
} catch {
// ignore URL parsing errors
@@ -634,7 +634,7 @@ function renderPageFailureFallback(pageId, error) {
stack: error?.stack || '',
context: {
pageId,
routeHash: window.location.hash || '',
routeHash: window.location.pathname || '',
},
});
@@ -1031,13 +1031,14 @@ async function init() {
startPeriodicUiVersionCheck();
await ensureSessionRuntimeStarted();
if (!window.location.hash) {
if (!window.location.pathname || window.location.pathname === '/' || window.location.pathname === '/index.html') {
navigate(state.session.isAuthorized ? 'messages-list' : 'start-view');
renderApp();
} else {
renderApp();
}
window.addEventListener('hashchange', renderApp);
window.addEventListener('popstate', renderApp);
document.addEventListener('visibilitychange', () => {
if (document.visibilityState !== 'visible') return;
void checkConnectionHealth();