Skip to content

fix(sitecore-jss-vue): preserve query string in RichText internal links (#2191) - #2221

Open
Ravi-Rabadiya-fullstack wants to merge 1 commit into
Sitecore:devfrom
Ravi-Rabadiya-fullstack:origin/bugfix/2191-richtext-routehandler-query-string
Open

Ravi-Rabadiya-fullstack wants to merge 1 commit into
Sitecore:devfrom
Ravi-Rabadiya-fullstack:origin/bugfix/2191-richtext-routehandler-query-string

Conversation

@Ravi-Rabadiya-fullstack

Copy link
Copy Markdown

Description

Fixes #2191
The RichText component's routeHandler method in @sitecore-jss/sitecore-jss-vue previously constructed the navigation destination using only target.pathname and target.hash, omitting target.search. Consequently, internal links with query parameters (e.g., /my-page?type=foo&section=bar) lost their query string during client-side SPA routing.
This PR updates routeHandler to include target.search alongside target.pathname and target.hash.

Changes

  • Updated packages/sitecore-jss-vue/src/components/RichText.ts to include target.search when building the destination URL.
  • Added unit tests in packages/sitecore-jss-vue/src/components/RichText.test.ts to test links with query strings (both with and without hash fragments).

Verification

  • yarn test in @sitecore-jss/sitecore-jss-vue passes (10/10 suites, 97/97 tests).
  • yarn lint passes.
  • yarn build compiles CJS and ESM distributions cleanly.
  • yarn lint-packages passes across all monorepo packages.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JSS 22 Vue] RichText routeHandler drops query string from internal links during SPA navigation

1 participant