mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix(navigation): single-tariff /subscriptions/:id deep-link shows Close, not Back
Refines3c2f650— that commit broke the loop by suppressing the single-tariff redirect on idx=0, but left the BackButton visible. The user still saw Back on the detail page and needed two taps (Back → Close) to exit. Серёжа's report was specifically that Back should not appear at all when you land on your only subscription via a bot button. Move the decision up to TelegramBackButton: - Subscribe to the existing ['subscriptions-list'] query (deduped by React Query, so no extra fetch). - On /subscriptions/:id, when multi_tariff_enabled is false and there is no in-app history (idx=0 deep-link entry), hide the BackButton. Telegram then surfaces its native Close (X) in the header. - Multi-tariff users still see BackButton on /subscriptions/:id deep-links because their /subscriptions list is meaningful (they have many subs). The2bcba3bfallback-to-parent behaviour remains intact for unrelated deep-links like /balance/top-up, /admin/*, etc. Revert the defensive guard in Subscriptions.tsx — the loop can no longer be triggered because no BackButton is shown to trigger it. Behaviour summary: flow BackButton exit cost -------------------------------------- ---------- --------- deep-link → /subscriptions/:id (1T) hidden Close, 1 tap / → /subscriptions → /subscriptions/:id shown Back → /, 1 tap deep-link → /balance/top-up shown Back → /balance ✓ deep-link → /subscriptions/:id (multi) shown Back → /subscriptions list Reported by Серёжа, bugs topic #599679.
This commit is contained in:
@@ -9,7 +9,6 @@ import { getGlassColors } from '../utils/glassTheme';
|
||||
import { useAuthStore } from '../store/auth';
|
||||
import SubscriptionListCard from '../components/subscription/SubscriptionListCard';
|
||||
import TrialOfferCard from '../components/dashboard/TrialOfferCard';
|
||||
import { hasInAppHistory } from '../utils/navigation';
|
||||
|
||||
function EmptyState({ onBuy }: { onBuy: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
@@ -107,11 +106,8 @@ export default function Subscriptions() {
|
||||
},
|
||||
});
|
||||
|
||||
// Single-tariff mode with one subscription: skip list, go directly to detail.
|
||||
// Skip the redirect when the user just hit the Telegram BackButton from
|
||||
// /subscriptions/:id — that lands us here with idx=0, and redirecting back
|
||||
// to the detail page creates a Back-button loop the user can't escape (#599679).
|
||||
if (data && !isMultiTariff && subscriptions.length === 1 && hasInAppHistory()) {
|
||||
// Single-tariff mode with one subscription: skip list, go directly to detail
|
||||
if (data && !isMultiTariff && subscriptions.length === 1) {
|
||||
return <Navigate to={`/subscriptions/${subscriptions[0].id}`} replace />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user