--- layout: docs title: DatabaseView ---

Summary

DatabaseView abstracts away the process of paginating a query and loading ranges of data. It's very smart about deciding when results need to be refreshed. There are a few core concepts that make it flexible:

metadataProvider: For each item loaded, you can provide a promise that resolves with additional data for that item. The DatabaseView will not consider the page of data "loaded" until all the metadata promises have resolved. (Used for message metadata on threads)

retainedRange: The retained range ({start, end}) represents the objects currently being displayed. React components displaying the view can alter the retained range as the user scrolls.

Note: Do not make the retainedRange larger than you need. The DatabaseView may internally keep a larger set of items loaded for performance.

Instance Methods

invalidate(options)

Call this method when the DatabaseStore triggers and will impact the data maintained by this DatabaseView. In the future, the DatabaseView will probably observe the DatabaseView directly.

TODO: In order for the DatabaseView to monitor the DatabaseStore directly, it needs to have some way of detatching it's listener when it's no longer needed! Need a destructor...

Parameters
Argument Description
options

an Object with the following optional keys which can be used to optimize the behavior of the DatabaseView: