From 2322f4364574798bd6a0177e0add9b573a6df460 Mon Sep 17 00:00:00 2001 From: Zachary Lee <35875283+lzach83@users.noreply.github.com> Date: Mon, 1 Apr 2024 21:19:33 -0400 Subject: [PATCH] 7315-customDomainCrash (#7316) * bug fix... maybe? * Handle missed case in breadcrumb switch statement. --------- Co-authored-by: Jake Naviasky --- .../views/components/Breadcrumbs/Breadcrumbs.tsx | 4 +++- .../scripts/views/components/Breadcrumbs/utils.ts | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/commonwealth/client/scripts/views/components/Breadcrumbs/Breadcrumbs.tsx b/packages/commonwealth/client/scripts/views/components/Breadcrumbs/Breadcrumbs.tsx index acefe803028..9ca44e9cefc 100644 --- a/packages/commonwealth/client/scripts/views/components/Breadcrumbs/Breadcrumbs.tsx +++ b/packages/commonwealth/client/scripts/views/components/Breadcrumbs/Breadcrumbs.tsx @@ -18,7 +18,8 @@ export const Breadcrumbs = () => { chainId: app.activeChainId(), ids: [getThreadId && Number(getThreadId[1])], apiCallEnabled: - location.pathname.split('/')[1].toLowerCase() === 'discussion', //Only call when in discussion pages prevents unnecessary calls. + // Only call when in discussion pages prevents unnecessary calls. + location.pathname.split('/')[1].toLowerCase() === 'discussion', }); const user = app?.user?.addresses?.[0]; @@ -55,6 +56,7 @@ export const Breadcrumbs = () => { location.pathname, profileId, navigate, + app.isCustomDomain() ? app.activeChainId() : undefined, currentDiscussion, ); diff --git a/packages/commonwealth/client/scripts/views/components/Breadcrumbs/utils.ts b/packages/commonwealth/client/scripts/views/components/Breadcrumbs/utils.ts index fa51b50f518..11625013aa8 100644 --- a/packages/commonwealth/client/scripts/views/components/Breadcrumbs/utils.ts +++ b/packages/commonwealth/client/scripts/views/components/Breadcrumbs/utils.ts @@ -46,11 +46,17 @@ export const generateBreadcrumbs = ( locationPath: string, profileId: number, navigate: (val: To) => void, + customDomain: string, currentDiscussion?: currentDiscussion, ) => { let link: string; let label: string; let isParent: boolean; + + if (customDomain) { + locationPath = `${customDomain}${locationPath}`; + } + const pathSegments = locationPath .split('/') .filter((segment) => segment.length > 0); @@ -67,12 +73,7 @@ export const generateBreadcrumbs = ( link = `profile/id/${profileId}`; break; case 'members': - if ( - pathSegments[index] === 'members' && - pathSegments[index + 1] === 'update' - ) { - link = 'members'; - } + link = 'members'; break; case 'snapshot': //Match the header on the snapshots page