diff --git a/src/pages/Info.tsx b/src/pages/Info.tsx index bba2d4f..af34bb4 100644 --- a/src/pages/Info.tsx +++ b/src/pages/Info.tsx @@ -374,7 +374,7 @@ export default function Info() { const locale = i18n.language.split('-')[0]; // Fetch tab replacements - const { data: tabReplacements } = useQuery({ + const { data: tabReplacements, isError: replacementsError } = useQuery({ queryKey: ['info-pages', 'tab-replacements'], queryFn: infoPagesApi.getTabReplacements, staleTime: 60_000, @@ -387,9 +387,9 @@ export default function Info() { staleTime: 60_000, }); - // Filter to only pages that don't replace a built-in tab + // Filter to only pages that don't replace a built-in tab and don't collide with built-in IDs const extraPages = useMemo( - () => (customPages ?? []).filter((p) => !p.replaces_tab), + () => (customPages ?? []).filter((p) => !p.replaces_tab && !BUILTIN_TABS.has(p.slug)), [customPages], ); @@ -406,8 +406,8 @@ export default function Info() { // Slug to fetch: either a custom page tab or a tab replacement const pageSlugToFetch = customTabSlug ?? currentTabSlug; - // Wait for tab replacements before firing built-in queries - const replacementsLoaded = tabReplacements !== undefined; + // Wait for tab replacements before firing built-in queries (also proceed on error — graceful degradation) + const replacementsLoaded = tabReplacements !== undefined || replacementsError; // Fetch the InfoPage when needed (replacement or custom tab) const { data: infoPage, isLoading: infoPageLoading } = useQuery({ @@ -496,9 +496,9 @@ export default function Info() { const tabs = [...builtinTabs, ...customTabs]; - const toggleFaq = (id: number) => { - setExpandedFaq(expandedFaq === id ? null : id); - }; + const toggleFaq = useCallback((id: number) => { + setExpandedFaq((prev) => (prev === id ? null : id)); + }, []); const renderInfoPageContent = () => { if (infoPageLoading) { @@ -525,8 +525,8 @@ export default function Info() { } return ( -
{t('info.updatedAt')}: {new Date(rules.updated_at).toLocaleDateString()} @@ -626,7 +629,10 @@ export default function Info() { return (
{t('info.updatedAt')}: {new Date(privacy.updated_at).toLocaleDateString()} @@ -651,7 +657,10 @@ export default function Info() { return (
{t('info.updatedAt')}: {new Date(offer.updated_at).toLocaleDateString()} @@ -723,13 +732,13 @@ export default function Info() {