Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kyusungpark opened this issue Sep 14, 2024 · 3 comments
Open
Labels
information needed Further information is requested

Comments

@kyusungpark
Copy link

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

@schiller-manuel
Copy link
Contributor

Can you please provide a minimal complete example, e.g. by forking one of the examples on stackblitz?

@schiller-manuel schiller-manuel added the information needed Further information is requested label Sep 14, 2024
@kyusungpark
Copy link
Author

kyusungpark commented Sep 15, 2024

Can you please provide a minimal complete example, e.g. by forking one of the examples on stackblitz?

I created one here. LINK
I was able to replicate the same behavior.

  1. On Home page, click button to go to /practice
  2. Notice that /practice route is masked correctly
  3. Now click on button to go to /report
  4. Notice that route is NOT is masked, there is extra expiresAt search params that is not supposed to be there. This is seems like it's persisting from /practice URL. The Devtool shows that current URL is masked, but it's not. The devtool also shows correct search params for /report, but the actual URL bar shows persited expiresAt from previously masked route (/practice)

@kyusungpark kyusungpark changed the title URL Search Params Persisting on Page Navigation URL Search Params Persisting on Page Navigation and Masking Not Working Sep 16, 2024
@kyusungpark
Copy link
Author

@schiller-manuel any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information needed Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants