reduxForm : is showing old data some milliseconds and then refreshed with new data

69 Views Asked by At

We are using React + React-Redux + Redux-Saga in our application, and the withRouter part of react-router-dom is used when connecting to the redux store.

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(App));

Issue Steps:

  1. I have all users listed on the users landing page.
  2. I click on one of the users, then the redirect happens using the withRouter, history.push function, which kicks the redirect on this.props.history.push(${REDIRECT_URL});, this shows the current clicked user-profile data.
  3. Now I come back to the users landing page
  4. I click on another user, it again kicks in the this.props.history.push(${REDIRECT_URL});, and the previously visited users data is shown in a blink of an eye or some milliseconds, and then the newly clicked user-profile data is shown.

reduxForm connected for my application is below

export default withRouter(connect(mapStateToProps, mapDispatchToProps)(reduxForm({
    form: 'userProfile', // this form needs to be fixed I guess with passing other `(k,v)` to the `reduxForm`
    enableReinitialize: true,
})(UserInformation)));

Is there a way to fix this? to not show the previously visited users data? Appreciate help or pointers.

0

There are 0 best solutions below