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

Shallow routing using URL object. #9862

Closed
brookslyrette opened this issue Dec 28, 2019 · 4 comments
Closed

Shallow routing using URL object. #9862

brookslyrette opened this issue Dec 28, 2019 · 4 comments

Comments

@brookslyrette
Copy link

Is it possible to invoke shallow routing when using with-url-object?

I've tried using:

router.push(
    {
      pathname,
      query,
      shallow: router.pathname.includes(pathname),
    },
  )

Which always invokes getInitalProps

If I use:

router.push(
    pathname,
    pathname, // TODO: expand query params here
    {
      shallow: router.pathname.includes(pathname),
    },
  )

Shallow routing works.

@timneutkens
Copy link
Member

timneutkens commented Dec 28, 2019

How did you ignore the issue template? Generally curious.


Please follow the issue template.

https://github.com/zeit/next.js/issues/new/choose

https://github.com/zeit/next.js/issues/new?template=8.Question_about_next.md

# Question about Next.js

GitHub Issues are reserved for Bug reports and Feature requests. The best place to get your question answered is to post it on https://spectrum.chat/next-js.

@brookslyrette
Copy link
Author

It was early and I was in a rush. Sorry about that.

@michaelwindell26
Copy link

michaelwindell26 commented Sep 30, 2020

Answer here: #16736 (comment)

Except for URL object like so:

router.push(
  {
    pathname: '/url', 
    query: { param1: 'value' }
  }, 
  undefined, 
  {
    shallow: true
  }
);

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants