Skip to content

Commit 6fcf1f1

Browse files
authored
refactor: introduce _shouldLoadCachePage to allow customization (#9984)
1 parent 0ad7791 commit 6fcf1f1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/component-base/src/data-provider-controller/data-provider-controller.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,25 @@ export class DataProviderController extends EventTarget {
226226
this.#loadCachePage(this.rootCache, 0);
227227
}
228228

229+
/**
230+
* Override to prevent loading of the cache page under certain conditions.
231+
*
232+
* @param {Cache} cache
233+
* @param {number} page
234+
* @protected
235+
*/
236+
_shouldLoadCachePage(_cache, _page) {
237+
return true;
238+
}
239+
229240
/** @private */
230241
#createRootCache(size) {
231242
return new Cache(this.#cacheContext, this.pageSize, size);
232243
}
233244

234245
/** @private */
235246
#loadCachePage(cache, page) {
236-
if (!this.dataProvider || cache.pendingRequests[page]) {
247+
if (!this.dataProvider || cache.pendingRequests[page] || !this._shouldLoadCachePage(cache, page)) {
237248
return;
238249
}
239250

0 commit comments

Comments
 (0)