Skip to content

shallow not working with dynamic routing #5922

@rawnly

Description

@rawnly

Bug report

When I try to push a new route with the option { shallow: true } it trigger getInitialProps ignoring the option.

The route is a dynamic route (with custom server) it's something like /handling-request/:id/:tab

I need the param tab to get direct to the selected tab, but I also need to update the url when the tab change.

If you have any suggestion/workaround I'm open to new solutions.

That's the code:

handleTabChange = (e, value) => {
	this.setState({ tabIndex: value });
	const { id } = this.props.router.query;

	Router.replace(`/handling-request?id=${id}&tab=${value}`, `/handling-request/${id}/${value}`, {
		shallow: true,
	});
};

(I'm using material-ui-react tabs)

System information

  • OS: macOS 10.14
  • Browser: Chrome
  • Version of Next.js: 7.0.2

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