dbeaver/pro#6592 fix: resources loading (#3660)

This commit is contained in:
Alexey Potsetsuev
2025-08-13 22:54:04 +08:00
committed by GitHub
parent a51765f516
commit db08bd1df8
@@ -336,29 +336,33 @@ export abstract class CachedResource<
return this.scheduler.wait();
}
// TODO: this method repeats isLoaded checks, maybe we can call just `this.isLoaded`
isOutdated(param?: ResourceKey<TKey>, includes?: TInclude): boolean {
if (param === undefined) {
param = CachedResourceParamKey;
}
if (!this.metadata.has(param)) {
return true;
}
const pageKey = this.aliases.isAlias(param, CachedResourceOffsetPageKey) || this.aliases.isAlias(param, CachedResourceOffsetPageListKey);
if (pageKey) {
const pageInfo = this.offsetPagination.getPageInfo(pageKey);
if (isOffsetPageOutdated(pageInfo?.pages || [], pageKey.options)) {
if (!pageInfo || !isOffsetPageInRange(pageInfo, pageKey.options) || isOffsetPageOutdated(pageInfo.pages, pageKey.options)) {
return true;
}
}
// TODO: this.metadata.size for some reason returns 0 when there is values
const size = [...this.metadata.values()].length;
return (
size === 0 ||
this.metadata.some(
param,
metadata => !metadata.loaded || metadata.outdated || !!includes?.some(include => metadata.outdatedIncludes.includes(include)),
)
return this.metadata.some(
param,
metadata =>
!metadata.loaded ||
metadata.outdated ||
!!includes?.some(include => metadata.outdatedIncludes.includes(include)) ||
!(!includes || includes.every(include => metadata.includes.includes(include))),
);
}