So we have been trying to solve this for hours and cant figure out whats the issue. I am afraid I cant include any code due to the companies policy, but I can include a sample code with an explanation.
Basically we have a function where we select all the table rows from the controller (simplified). Example:
selectAllRows = action(() => {
this.data.forEach(r=> {
this.selectTableRow(r, tableInstance)
})
})
and selectTableRow is just a simple function which sets the value to an observable object:
selectTableRow = action((row, tableInstance) => {
tableInstance.multiSelectedRows[row.id] = row.id
})
So when we have lets say 100 rows and we select by calling a button and calling selectAllRows function via onClick method or if we call it directly in componentDidMount life cycle, the table rows are selected instantly, no problems - all good.
As soon as this function is being called from anywhere else lets say if we call it from the esc key listener, or we wrap it with the setTimeout funcion. As soon as that function gets executed, it hangs the UI for a second or 2 and then selects the rows as normal - render issue, problem unknown.
So the problem is that we cant understand why the same function is working fine when its being called directly and not when its wrapped within the async function.
Any tips or if someone recognises the problem and can help us out would be appreciated!
EDITED: Also to note, we removed all the action wrapping from the functions and did the same test, and it was the same problem. onClick call executed fast and the other one slow.