From 9e2c9f643ec03de20769c8ab77bfc3881cd413e9 Mon Sep 17 00:00:00 2001 From: Addy Pathania Date: Tue, 10 May 2022 09:16:58 -0400 Subject: [PATCH 1/2] fixed issue for sending queryparms with pathname --- packages/sitecore-jss-nextjs/src/components/RichText.test.tsx | 4 ++-- packages/sitecore-jss-nextjs/src/components/RichText.tsx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx b/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx index 9513813309..9c32096603 100644 --- a/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx +++ b/packages/sitecore-jss-nextjs/src/components/RichText.test.tsx @@ -97,7 +97,7 @@ describe('RichText', () => { const props = { field: { value: - '

Hello!

t1t2
', + '

Hello!

t1t2
', }, internalLinksSelector: 'a[href^="/testpath"]', }; @@ -119,7 +119,7 @@ describe('RichText', () => { const link1 = links && links[0]; const link2 = links && links[1]; - expect(link1!.href).to.equal('/testpath/t1'); + expect(link1!.href).to.equal('/testpath/t1?test=sample1'); expect(link2!.href).to.equal('/t2'); link1 && link1.click(); diff --git a/packages/sitecore-jss-nextjs/src/components/RichText.tsx b/packages/sitecore-jss-nextjs/src/components/RichText.tsx index f69d297a19..32da3fb4bf 100644 --- a/packages/sitecore-jss-nextjs/src/components/RichText.tsx +++ b/packages/sitecore-jss-nextjs/src/components/RichText.tsx @@ -37,7 +37,8 @@ export const RichText = (props: RichTextProps): JSX.Element => { ev.preventDefault(); - const pathname = (ev.target as HTMLAnchorElement).pathname; + const pathname = (ev.target as HTMLAnchorElement).href; + console.log(pathname); router.push(pathname, pathname, { locale: false }); }; From e3d3c9214614741d723fd226985ec3806db01095 Mon Sep 17 00:00:00 2001 From: Addy Pathania Date: Tue, 10 May 2022 09:37:20 -0400 Subject: [PATCH 2/2] remove console.log --- packages/sitecore-jss-nextjs/src/components/RichText.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/sitecore-jss-nextjs/src/components/RichText.tsx b/packages/sitecore-jss-nextjs/src/components/RichText.tsx index 32da3fb4bf..3e96b6df24 100644 --- a/packages/sitecore-jss-nextjs/src/components/RichText.tsx +++ b/packages/sitecore-jss-nextjs/src/components/RichText.tsx @@ -38,7 +38,6 @@ export const RichText = (props: RichTextProps): JSX.Element => { ev.preventDefault(); const pathname = (ev.target as HTMLAnchorElement).href; - console.log(pathname); router.push(pathname, pathname, { locale: false }); };