From eb0ad25c3c379ed9343da2e3af5b7f877c564f93 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 18 Sep 2025 15:12:58 +0300 Subject: [PATCH] fix back-button on /pro --- apps/web/hooks/telegram/use-back-button.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/hooks/telegram/use-back-button.ts b/apps/web/hooks/telegram/use-back-button.ts index 58238db..3e9632d 100644 --- a/apps/web/hooks/telegram/use-back-button.ts +++ b/apps/web/hooks/telegram/use-back-button.ts @@ -4,6 +4,8 @@ import { backButton } from '@telegram-apps/sdk-react'; import { usePathname, useRouter } from 'next/navigation'; import { useCallback, useEffect } from 'react'; +const exclude = ['/pro']; + export function useBackButton() { const { back } = useRouter(); const pathname = usePathname(); @@ -31,6 +33,8 @@ export function useBackButton() { }, [pathname]); } -function isRootLevelPage(path: string) { - return path.split('/').filter(Boolean).length === 1; +function isRootLevelPage(pathname: string) { + if (exclude.includes(pathname)) return true; + + return pathname.split('/').filter(Boolean).length === 1; }