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

Router.push('/') is not routing back to my page/index.js file. #8624

Closed
Kiel-H-Byrne opened this issue Sep 4, 2019 · 7 comments
Closed

Router.push('/') is not routing back to my page/index.js file. #8624

Kiel-H-Byrne opened this issue Sep 4, 2019 · 7 comments

Comments

@Kiel-H-Byrne
Copy link

Kiel-H-Byrne commented Sep 4, 2019

Bug report

Describe the bug

Simple javascript function to Router.push("/") will not work correctly.

in _app.js has:

Router.events.on('routeChangeStart', url => {
  console.log(`Loading: ${url}`);
});

which is working...

in my AppBar(Material-ui Toolbar) i have a simple onClick (i've also tried with <Link> to no avail)

<Avatar
            src="/static/img/favicon-96x96.png"
            onClick={() => Router.push(ROUTE.LANDING)}
          />

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Create a new <Link> with href to "/" ....see if it redirects to your homepage from another page.
or
Create a new element with an onChange parameter. onChange={Router.push("/")} and see if it redirects to home page from another page.
The current page will stay rendered, however the routeChangeStart callback will fire...

Expected behavior

I expect the home page (index.js) to be rendered within a few seconds of calling Router.push or clicking a <Link> with href="/"

Screenshots

image

image of the routeChangeStart consoling out in _app.js

System information

  • OS: both macOS and Windows
  • i've tested with Firefox, Chrome, and Safari.
  • "next": "^9.0.5"

Additional context

Reopening from #5264 .

Thank you!

@ijjk
Copy link
Member

ijjk commented Sep 4, 2019

Hi, are you using next-css and importing CSS files outside of _app? If so this is a duplicate of #7886 and vercel/next-plugins#282

@Kiel-H-Byrne
Copy link
Author

OMG thanks! I believe I'm calling the css file from _app. But I'll research the referenced issue and investigate my code thoroughly.

Please allow me a few hours to close this out myself and document accordingly.

🙏🏽

@timneutkens
Copy link
Member

If you're using next-css it's definitely the same as vercel/next-plugins#282

So I'll close this issue and we're already tracking it there.

@Kiel-H-Byrne
Copy link
Author

Dude do you have OCD with closing issues? I just asked for a little time to verify that this was indeed the issue, you closed this without verifying anything....

@timneutkens
Copy link
Member

timneutkens commented Sep 5, 2019

https://github.com/zeit/next.js/blob/canary/CODE_OF_CONDUCT.md

Specifically:

Examples of unacceptable behavior by participants include:
Trolling, insulting/derogatory comments, and personal or political attacks

Dude do you have OCD with closing issues?

This falls under insulting/derogatory comments.


This is not a bug in Next.js itself. It's a problem in webpack and there's 2 open issues as @ijjk outlined. So there is no reason to keep this issue open.

It's already on the roadmap to be fixed, see #8626

This issue by itself is not reproducible based on the steps provided.

@ianfabs
Copy link

ianfabs commented Aug 5, 2020

I fixed it with Router.push('/', '/')

@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

5 participants