mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge remote-tracking branch 'origin/refactor/CB-2372' into refactor/CB-2372
This commit is contained in:
@@ -166,10 +166,7 @@ export class ConnectionFolderResource extends CachedMapResource<IConnectionFolde
|
||||
return key;
|
||||
}
|
||||
|
||||
const ref = this.keys.find(k => (
|
||||
k.projectId === key.projectId
|
||||
&& k.folderId === key.folderId
|
||||
));
|
||||
const ref = this.keys.find(k => this.isKeyEqual(k, key));
|
||||
|
||||
if (ref) {
|
||||
return ref;
|
||||
|
||||
@@ -370,7 +370,7 @@ export abstract class CachedMapResource<
|
||||
}
|
||||
|
||||
if (this.isAlias(param) || this.isAlias(key)) {
|
||||
return param === key;
|
||||
return this.isAliasEqual(param, key);
|
||||
}
|
||||
|
||||
param = ResourceKeyUtils.mapKey(param, this.getKeyRef.bind(this));
|
||||
@@ -451,7 +451,7 @@ export abstract class CachedMapResource<
|
||||
this.loadedKeys = [];
|
||||
} else {
|
||||
if (this.isAlias(key)) {
|
||||
const index = this.loadedKeys.findIndex(loadedKey => this.includes(key!, loadedKey));
|
||||
const index = this.loadedKeys.findIndex(loadedKey => this.isAliasEqual(key!, loadedKey));
|
||||
|
||||
if (index >= 0) {
|
||||
this.loadedKeys.splice(index, 1);
|
||||
|
||||
@@ -238,7 +238,7 @@ export abstract class CachedResource<
|
||||
}
|
||||
|
||||
isAliasLoaded(key: TParam): boolean {
|
||||
return this.loadedKeys.some(loadedKey => this.includes(key, loadedKey));
|
||||
return this.loadedKeys.some(loadedKey => this.isAliasEqual(key, loadedKey));
|
||||
}
|
||||
|
||||
isIncludes(key: TParam, includes: TContext): boolean {
|
||||
@@ -427,7 +427,7 @@ export abstract class CachedResource<
|
||||
|
||||
protected markOutdatedSync(param: TParam): void {
|
||||
if (this.isAlias(param)) {
|
||||
const index = this.loadedKeys.findIndex(key => this.includes(param, key));
|
||||
const index = this.loadedKeys.findIndex(key => this.isAliasEqual(param, key));
|
||||
|
||||
if (index >= 0) {
|
||||
this.loadedKeys.splice(index, 1);
|
||||
@@ -440,6 +440,16 @@ export abstract class CachedResource<
|
||||
this.onDataOutdated.execute(param);
|
||||
}
|
||||
|
||||
isAliasEqual(param: TParam, second: TParam): boolean {
|
||||
return this.paramAliases.some(alias => {
|
||||
if ('getter' in alias && alias.getter) {
|
||||
return alias.param(param) && alias.param(second);
|
||||
} else {
|
||||
return alias.param === param && alias.param === second;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isKeyEqual(param: TParam, second: TParam): boolean {
|
||||
return param === second;
|
||||
}
|
||||
@@ -450,7 +460,7 @@ export abstract class CachedResource<
|
||||
}
|
||||
|
||||
if (this.isAlias(param) || this.isAlias(second)) {
|
||||
return param === second;
|
||||
return this.isAliasEqual(param, second);
|
||||
}
|
||||
|
||||
param = this.transformParam(param);
|
||||
|
||||
Reference in New Issue
Block a user