Skip to content

URL Search Params Persisting on Page Navigation and Masking Not Working #2337

Description

@kyusungpark

Which project does this relate to?

Router

Describe the bug

Hi, I added a few route masks and it used to all work properly, but now only 1 of 3 works and I can't figure out why the other two aren't working. Only /practice works properly. I also noticed that when i navigate from /practice to /report, it leaves off 2 search params that is not supposed to be in /report page.

Users are able to navigate from: /practice -> /report -> /review

My routes

export const Route = createFileRoute('/_authenticated/(tests)/practice')({
  component: TestRenderer,
  errorComponent: NoAccess,
  validateSearch: (search) => practiceSearchParamsSchema.parse(search),
  beforeLoad: ({ search }) => {}),
});

export const Route = createFileRoute('/_authenticated/(tests)/review')({
  component: ReviewRenderer,
  validateSearch: (search) => reviewSearchParamsSchema.parse(search),
});

export const Route = createFileRoute('/_authenticated/(tests)/report')({
  component: ReportRenderer,
  validateSearch: (search) => reportSearchParamsSchema.parse(search),
});

My masks

const testMask = createRouteMask({
  routeTree,
  from: '/practice',
  to: '/practice',
  search: true,
});

const reviewMask = createRouteMask({
  routeTree,
  from: '/review',
  to: '/review',
  search: true,
});

const reportMask = createRouteMask({
  routeTree,
  from: '/report',
  to: '/report',
  search: true,
});

/practice works properly
Screenshot 2024-09-13 at 8 26 04 AM

/report page - not masked

  • also notice that search params from previous page (practice) is persisted.
  • You can see in the devTool that it shows 3 search params, but in the url, there are extra that is not specified
  • Devtool shows that the route is masked, but it's not
    Screenshot 2024-09-13 at 8 26 29 AM

/review page - not masked, but search params from /practice is not persisted

Your Example Website or App

n/a

Steps to Reproduce the Bug or Issue

n/a

Expected behavior

  1. I would expect search params to not persist between pages.
  2. I would expect route mask to work properly.

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions