SHA256
UI: переход на history-router без # и короткие ссылки тредов
This commit is contained in:
+5
-4
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user