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

shouldWorkAgain invoke the constructor with React 16 #50

Open
stelro opened this issue Jan 13, 2018 · 1 comment
Open

shouldWorkAgain invoke the constructor with React 16 #50

stelro opened this issue Jan 13, 2018 · 1 comment

Comments

@stelro
Copy link

stelro commented Jan 13, 2018

Hello, I don't know if this is the normal behavior, but every time shouldWorkAgain is called, the constructor of the component is invoked, thus is construct the component again every time. This happens after I upgraded to React 16, with React 15 I don't have this behavior.

Here is my code :

@inject('userStore')
@withRouter
@observer
@withJob({
  work: ({ userStore, match }) => {
      return userStore.fetchUserListings(match.params.params);
  },
  shouldWorkAgain: (prev, next) => {
    return (prev.match.params.params !== next.match.params.params);
  },
  LoadingComponent,
  ErrorComponent,
  serverMode: 'defer',
})
export default class UpListingsView extends Component {
  //....
}

@ctrlplusb
Copy link
Owner

Hey @stelro

Sorry for the late reply. I have been doing some update rounds on my libs and am trying to push this lib forward.

Would you be happy to create a minimal example of this on codesandbox.io?

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

No branches or pull requests

2 participants