Batch-type call that only renders if necessary

I have a situation where a bunch of code outside of my direct control may or may not cause renders, all as a result of an event that I trigger. While I can wrap that trigger in a batchRender (which would solve the problem), my concern is that it appears Handsontable will do a render there even if nothing happened during the batch callback that would trigger a render. Is there a way to batch or suspend renders that will cause a render only if one was pending?

Hi @dhaber

Did you try using the suspendRender and resumerRender methods from the batching API?

I see a render happen as a result of this:

hotInstance.suspendRender();
console.log('After suspendRender');
hotInstance.resumeRender();

So that doesn’t seem to meet the need.

@dhaber

Currently, that’s the only option we have to suspend rendering. Handsontable’s structure in general works in a way that it re-renders the table with any action or event happening, and beside those batching hooks we have no way to alter this behavior for now.

Understood. Seems like it would make a nice improvement though. :wink:

Thanks for taking a look.