mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
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:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user