Using setState in afterColumnFilter function
See original GitHub issueIt will crash program after I use setState in afterColumnFilter.
getFilterResult = (f, result) => {
Promise.resolve(this.somethingComputing(result))
.then(data => this.setState({data: data}))
}
render(){
const options = {
afterColumnFilter: this.getFilterResult
}
}
It will call setState many time…
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
using setState after function - Stack Overflow
i try it using setState after function in react, first run function , function finished after run setState({example:'example1'}) , how i can ...
Read more >ReactJS setState() - GeeksforGeeks
Syntax: We can use setState() to change the state of the component directly as well as through an arrow function. setState({ stateName : ......
Read more >State and Lifecycle - React
This page introduces the concept of state and lifecycle in a React component. You can find a detailed component API reference here.
Read more >How to become a pro with React setState() in 10 minutes
Whether you declare a Component as a function or a class, it must never modify its own props. All React Components must act...
Read more >React setState usage and gotchas - ITNEXT
Signature. setState(updater[, callback]). The first argument is an updater function with the signature: ( ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AllenFang Doing some computing for data.
Do you have any suggestion for us to achieve this goal?
@AllenFang I have a use case for you.
We have been working with react-bootstrap-table v4.0.0-beta.1. We had issues with users of our app selecting multiple rows, then choosing to filter the rows. If they did this, the rows remained selected that were now no longer visible, and if they executed an action on the visible rows that were selected, it would also execute on the rows hidden by the filter.
To avoid this, we have an afterColumnFilter function that sets a property in state,
currentFilteredData
, storing a record of all the visible selected rows so we only execute commands on those rows.Now that we are attempting to upgrade to 4.2.0, it’s an infinite loop, as others have experienced. We can store the filter conditions and do a comparison, only setting the state if the conditions have changed, but this seems like a bad workaround for a breaking change.