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

Wrapper doesn't support Next 14 #564

Open
jarriaza-102 opened this issue Nov 9, 2023 · 4 comments
Open

Wrapper doesn't support Next 14 #564

jarriaza-102 opened this issue Nov 9, 2023 · 4 comments
Labels

Comments

@jarriaza-102
Copy link

jarriaza-102 commented Nov 9, 2023

Describe the bug

useRouter hook gotten from next/router is throwing errors while working with Next 14, development server is going alright, it's just whenever build process take place and run the built version of the code.

This file in next-redux-wrapper is using next/router, and that's outdated for Next 14.
There's a file on Next 14 that is throwing an error when router doesn't exist, and the router gotten from next/router is the guilty of that, there should be a migration to next/navigation.

To Reproduce

Update to Next 14 and wrap component with reduxWrapper.withRedux.

Expected behavior

Wrapper should run with Next 14, I think problem is also on Next >= 13.5

Desktop (please complete the following information):

  • OS: Mac OS 14.0
  • Browser Console
  • Version 8.1.0

Additional context

I did a change in my node_modules folder removing the code that is using useRouter from next/router, and it works just fine!
Also there's no way to use redux-wrapper with generateStaticParams.

@LLLLLamHo
Copy link

I have the same problem and I am looking for a perfect solution. Is there a perfect solution to solve this problem? @jarriaza-102

@jarriaza-102
Copy link
Author

I have the same problem and I am looking for a perfect solution. Is there a perfect solution to solve this problem? @jarriaza-102

I don't think there's a "clean" solution for this, I would say the code in the library should be changed to not use the outdated code.

@LLLLLamHo
Copy link

I have the same problem and I am looking for a perfect solution. Is there a perfect solution to solve this problem? @jarriaza-102

I don't think there's a "clean" solution for this, I would say the code in the library should be changed to not use the outdated code.

To deal with this, I created a new repository, upgraded it based on Next-redux-wrapper, upgraded both react and next, and still passed all the original tests. At present, my own project has been connected to next-redux-wrapper-future development. Consider giving it a try to see if it solves your problem.

@Andrea-Dispe
Copy link

Andrea-Dispe commented Jan 7, 2024

I have the same issue and, if I interpreted correctly, the App Router architecture doesn't work with next-redux-wrapper but only Pages Router architecture works with it.
From the Redux official doc it says:

The Pages Router is the original architecture for Next.js. If you're using the Pages Router, Redux setup is primarily handled by using the next-redux-wrapper library, which integrates a Redux store with the Pages Router data fetching methods like getServerSideProps.

And for App Router it explains the steps to follow:
https://redux.js.org/usage/nextjs

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

No branches or pull requests

3 participants