Skip to content

@eightkk/vue-weave / core / setWindowedView

Function: setWindowedView() ​

setWindowedView<T, L>(state, view, condition?): WindowedDataTransition<T, L>

Defined in: src/core/windowedData.ts:292

Sets the view (and optionally the condition) and plans requests for its missing cells. Requests in flight whose cells are all outside the new view are aborted, and their cells become unloaded again; a request that still covers some needed cell keeps running. A different condition (a filter, a query, a data version) aborts everything and drops all cells, items and links, so results for another condition are never attached. view undefined keeps the cells and data but aborts every request. A view with an empty rowIds needs no cell: it requests nothing and aborts every request. The work is bounded by maxCells. Throws RangeError for a non-finite view, end < start, more than maxCells cells, or a view so far from origin for chunkSize that its chunk indices are not safe integers or its chunk boundaries (origin + k * chunkSize) are not distinct finite numbers, Error (Invalid view row ID: <value>) for a row ID that is not a non-empty string (a repeated row ID is dropped, not an error), and TypeError for a view that is not an object, rowIds that is not an array or a condition that is not a string. A throw changes nothing: the given state is still the current one, with its condition, requests and data. To switch the condition even when the new view may be invalid, switch it first without a view (setWindowedView(state, undefined, condition), which never throws for a string condition), apply that transition, and then set the view; useWindowedData does this.

Type Parameters ​

T ​

T

L ​

L = never

Parameters ​

state ​

WindowedDataState<T, L>

view ​

WindowedView | undefined

condition? ​

string = state.condition

Returns ​

WindowedDataTransition<T, L>

Released under the MIT License.