cilantro
cilantro copied to clipboard
Add stats model to Context and Query models
This corresponds to cbmi/serrano#143 which offloads re-counts and other stats to a separate endpoint that can be requested/managed independent of saving context, view and query objects.
An approach would be to initialize a stats
instance on Context
and Query
objects that is bound to the stats endpoint. It can listen to the sync
event of it's parent to know when the stats should be refreshed. An option could be added to define its behavior to immediately refresh (debounced), wait some time before refreshing, or require a manual refresh. This gives full control to the client application to facilitate the workflow.
At a minimum the sync
event will cause the stats model to marked itself as "out-of-date" which can be reflected in the UI in the count regions. Clicking on those regions could manually trigger a refresh if the manual
option is selected.