kirill-konshin / next-redux-wrapper

Redux wrapper for Next.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No HYDRATE action dispatched

samends opened this issue · comments

Describe the bug

For pages not returned in the list of slugs on initial call of getStaticPaths (for example, a new page added or a non existent page), no HYDRATE action is dispatched when I use incremental regeneration with getStaticPaths with fallback set to true. No HYDRATE action leads to the server side state not getting propagated to client side state for those particular pages

The following is the dependency versions I was using when seeing this issue

    "@types/node": "14.0.5",
    "@types/react": "18.0.27",
    "@types/react-dom": "18.0.10",
    "@types/react-redux": "7.1.25",
    "@types/webpack-env": "1.15.2",
    "next": "12.3.1",
    "next-redux-wrapper": "8.1.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-redux": "7.2.9",
    "redux": "4.0.1",
    "typescript": "4.8.4"

To Reproduce

To reproduce use the codesandbox I created and go through the following steps:
Link to codesandbox

Steps to reproduce the behavior:

  1. Once in codesandbox click the "Open Navigator" button

Screen Shot 2023-05-03 at 1 55 59 PM

2. Add `/testPage` to the URL

step2

3. Notice how the `page` state is still `init` and not `testtest` as it should be showing as `getStaticProps` in the `slug.tsx` file dispatches an action with the payload `testtest`

step3

step4

Note that if you use the page link to get to the test page you do not see this issue. This is likely because when a page with fallback: true is navigated to through next/link or next/router (client-side) Next.js will not serve a fallback and instead the page will behave as fallback: 'blocking'.
step5
step6