-
Notifications
You must be signed in to change notification settings - Fork 431
Description
I am fetching data from remote server with a function demo as can be seen in codesandbox at line 9. But when I try to create a new date type that is what filter: dateFilter() takes as input, it crashes.
The problem basically is that it doesn't wait for the async setState of the fetched data from server, before it tries to put the filter and I get the following error:
react-dom.development.js:12299 Uncaught TypeError: Cannot read property 'dateBgn' of undefined
as I have a did Mount flag checking if it has mounted. I have put flags, but it keeps on happening:
componentDidMount(){
this.getMahList('http://localhost:8080/blahblah')
}
componentWillUnmount() {
this._isMounted = false;
}
codesandbox: https://codesandbox.io/embed/error-with-datefilter-j2l37?fontsize=14&hidenavigation=1&theme=dark
I try and follow the demo from storybook: https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Column%20Filter&selectedStory=Date%20Filter&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel