Skip to content

shouldWorkAgain invoke the constructor with React 16 #50

@stelro

Description

@stelro

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 {
  //....
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions