fix: get fresh Telegram WebApp reference on each popup call

Telegram may reinitialize window.Telegram.WebApp after app startup,
making cached references stale. Get a fresh reference inside
showPopupSafe to ensure the callback is registered on the current
WebApp instance.
This commit is contained in:
c0mrade
2026-02-04 09:27:04 +03:00
parent ef77276246
commit 792fb1ed8a

View File

@@ -181,7 +181,6 @@ function createHapticController(): HapticController {
}
function createDialogController(): DialogController {
const tg = getTelegram();
const inTelegram = isInTelegramWebApp();
let popupOpen = false;
@@ -190,6 +189,8 @@ function createDialogController(): DialogController {
mapResult: (buttonId: string) => T,
fallback: () => T,
): Promise<T> {
const tg = getTelegram();
if (!inTelegram || !tg?.showPopup) {
return Promise.resolve(fallback());
}