mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +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 {
|
function createDialogController(): DialogController {
|
||||||
const tg = getTelegram();
|
|
||||||
const inTelegram = isInTelegramWebApp();
|
const inTelegram = isInTelegramWebApp();
|
||||||
let popupOpen = false;
|
let popupOpen = false;
|
||||||
|
|
||||||
@@ -190,6 +189,8 @@ function createDialogController(): DialogController {
|
|||||||
mapResult: (buttonId: string) => T,
|
mapResult: (buttonId: string) => T,
|
||||||
fallback: () => T,
|
fallback: () => T,
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
|
const tg = getTelegram();
|
||||||
|
|
||||||
if (!inTelegram || !tg?.showPopup) {
|
if (!inTelegram || !tg?.showPopup) {
|
||||||
return Promise.resolve(fallback());
|
return Promise.resolve(fallback());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user