From 30ccd2061b2eeebb2a8a14d1f8d7bcbb1e055f5e Mon Sep 17 00:00:00 2001 From: iandebruin98 Date: Wed, 23 Oct 2024 10:35:24 +0200 Subject: [PATCH] fix: Use relative path for the back button to the document --- packages/resource-detail/src/resource-detail.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/resource-detail/src/resource-detail.tsx b/packages/resource-detail/src/resource-detail.tsx index 6563a3e82..819eba9b6 100644 --- a/packages/resource-detail/src/resource-detail.tsx +++ b/packages/resource-detail/src/resource-detail.tsx @@ -152,8 +152,10 @@ function ResourceDetail({ if (hash && hash.includes('#doc=')) { const docParams = hash.split('#doc=')[1]; - if (docParams && docParams.includes('?')) { - const queryParams = docParams.split('?')[1]; + const cleanDocParams = docParams.split('#')[0]; + + if (cleanDocParams && cleanDocParams.includes('?')) { + const queryParams = cleanDocParams.split('?')[1]; if (queryParams) { const params = queryParams.split('&'); @@ -161,7 +163,7 @@ function ResourceDetail({ for (const param of params) { const [key, value] = param.split('='); - if (key && value && !isNaN(Number(value))) { + if (value && !isNaN(Number(value))) { return value; } }