Rendering a large collection can tie up the browsing context and generate long-running script errors.
It's pretty obvious that consumers with large collections should also consider partitioning/paginating their collections to make for an acceptable user experience. However, for consumers that are okay with rendering things in batches, it would be a good idea for CollectionBinder to support some sort of renderBatchSize option (or similar) and render in chunks of that size, calling setTimeout to return control back to the browser temporarily in between. If that option is not specified, all items would render synchronously. Ideally, this logic would activate both on initial bind calls and every time a collection add occurs with more than renderBatchSize models being added.
I'll work on a pull request along these lines in the next couple of days, but if anyone wants to have a go before I do, feel free.
Rendering a large collection can tie up the browsing context and generate long-running script errors.
It's pretty obvious that consumers with large collections should also consider partitioning/paginating their collections to make for an acceptable user experience. However, for consumers that are okay with rendering things in batches, it would be a good idea for CollectionBinder to support some sort of
renderBatchSize
option (or similar) and render in chunks of that size, callingsetTimeout
to return control back to the browser temporarily in between. If that option is not specified, all items would render synchronously. Ideally, this logic would activate both on initialbind
calls and every time a collectionadd
occurs with more thanrenderBatchSize
models being added.I'll work on a pull request along these lines in the next couple of days, but if anyone wants to have a go before I do, feel free.