vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.99k stars 26.99k forks source link

with-rematch example, data not dispatched in the redux store #14032

Closed RobinLebhar closed 4 years ago

RobinLebhar commented 4 years ago

Bug report

with-rematch example, data not dispatch in the store

In the with-rematch example, we display a list of github users and dispatch user data to the store but they do not seems to be set in the store.

To Reproduce

  1. Start the project with-rematch
  2. Click on the async example link
  3. Open redux-dev-tool
  4. See the the github/users is an empty array

Expected behavior

The github users should appear in the redux store

Screenshots

1

RobinLebhar commented 4 years ago

My bad it seems that it works as intended ? But I don't understand why the server side dispatch that is called in getStaticProps is not sent to the client ? Does it means that I have in the componentWillMount to call another dispatch (client side) and set the user list using the props that have been passed by the server ?

export async function getStaticProps() {
  const store = initializeStore()
  const usersList = await store.dispatch.github.fetchUsers() // this is not sent to the client 
  return {
    props: {
      usersList,
    },
  }
}
balazsorban44 commented 2 years ago

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.