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

Update 5.3.0 broke router usage in _app.js #181

Open
chemicalkosek opened this issue Mar 5, 2022 · 3 comments · May be fixed by #182
Open

Update 5.3.0 broke router usage in _app.js #181

chemicalkosek opened this issue Mar 5, 2022 · 3 comments · May be fixed by #182

Comments

@chemicalkosek
Copy link

chemicalkosek commented Mar 5, 2022

Update 5.3.0 broke router usage.
I was using router like this in _app.js:

function MyApp({ Component, apollo, pageProps, router }) {
  const { route } = router;
  if (route === '/login') { }

Now router is undefined

@macrozone
Copy link
Contributor

i see, we destrucutre router out of props, now it does not get passed to render / Page

macrozone added a commit to macrozone/next-with-apollo that referenced this issue Mar 5, 2022
@macrozone macrozone linked a pull request Mar 5, 2022 that will close this issue
@chemicalkosek
Copy link
Author

I have fixed it by just using:

import { useRouter } from 'next/router'

function MyApp({ Component, apollo, pageProps }) {
  const { route } = useRouter();

  if (route === '/login') { }

(...)

Seems to work the same for now, but that's still a breaking change for some probably.

@macrozone
Copy link
Contributor

yes, pushed a pr to fix it! sorry for that

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

Successfully merging a pull request may close this issue.

2 participants