Skip to content

Shallow routing for dynamic routes #8101

@yantakus

Description

@yantakus

Hi. Is there a way with next.js v9 to navigate from /post/123 to /post/124 shallowly?
Here's my page structure:

pages
  post
    [id]

Tried

const href = `/post/124`
const as = href
Router.push(href, as, {shallow: true})

when I'm on /post/123 page with no luck (the page refreshes).

What I need to achieve - I have a sidebar with posts list on the left of the page and selected post on the right. So when clicking a post title in sidebar I show it on the right and I also need to update the url, without refreshing the page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions