Skip to content

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

Description

@tomasz-wieclaw-wttech

Describe the Bug

The RichText component's routeHandler method builds the navigation destination using only target.pathname and target.hash, omitting target.search. Internal links with query parameters lose their query string during client-side routing.

const destination = target.hash ? `${target.pathname}${target.hash}` : target.pathname;

To Reproduce

  1. Add an internal link with query parameters to a Rich Text field in Sitecore, e.g. /my-page?type=foo&section=bar
  2. Render it using the Rich Text component in a Vue 3 JSS app
  3. Click the link
  4. The app navigates to /my-page and query parameters are stripped

Expected Behavior

The full URL including query string should be preserved during SPA routing

Possible Fix

Include target.search alongside with the target.hash and target.pathname

Provide environment information

  • Sitecore Version: 10.4.1 + JSS 22.0 (Headless)
  • JSS Version: @sitecore-jss/sitecore-jss-vue 22.9.1
  • Browser Name and version: not browser specific
  • Operating System and version (desktop or mobile): not OS specific
  • Link to your project (if available): N/A

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions