From c9b78d9e5b3f85dc2e577f6f0ca5ed02c2020a7c Mon Sep 17 00:00:00 2001 From: wasrusgen Date: Wed, 13 May 2026 10:12:30 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20role=20chooser=20=D0=B8=D0=B3=D0=BD?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20hash=20#tgWe?= =?UTF-8?q?bAppData=20=D0=BE=D1=82=20Telegram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit При открытии MiniApp Telegram ставит location.hash = '#tgWebAppData=...'. Старая проверка !location.hash считала это занятым роутом и пропускала chooser. Теперь проверяем только наши роуты #/podbor / #/clients и т.п. Cache bust v=20260513o. --- miniapp/assets/app.js | 8 ++++++-- miniapp/index.html | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/miniapp/assets/app.js b/miniapp/assets/app.js index d9c82b6..31101f7 100644 --- a/miniapp/assets/app.js +++ b/miniapp/assets/app.js @@ -725,8 +725,12 @@ async function init() { window.addEventListener("hashchange", routeByHash); const qp = new URLSearchParams(window.location.search); + // Telegram ставит #tgWebAppData=... в hash при открытии — это НЕ наш роут. + // Считаем «есть навигационный hash» только если он начинается с #/ + const hasAppRoute = location.hash.startsWith("#/"); + const goScreen = qp.get("go"); - if (goScreen && !location.hash) { + if (goScreen && !hasAppRoute) { const map = { podbor: "#/podbor", clients: "#/clients", @@ -740,7 +744,7 @@ async function init() { // Если нет ?role= в URL — показываем выбор роли (универсально для всех клиентов) const explicitRole = qp.get("role"); - if (!explicitRole && !location.hash) { + if (!explicitRole && !hasAppRoute) { renderRoleChooser(); hideSplash(); return; diff --git a/miniapp/index.html b/miniapp/index.html index ae264c3..0274dc0 100644 --- a/miniapp/index.html +++ b/miniapp/index.html @@ -12,8 +12,8 @@ - - + + @@ -34,13 +34,13 @@
- - - - - - - - + + + + + + + +