fix(editor): Error dropdown in resource locator disappears when search filter is required (#9681)

This commit is contained in:
Elias Meire
2024-06-18 11:11:10 +02:00
committed by GitHub
parent 7c358e5baa
commit 1a3f72b751
4 changed files with 35 additions and 5 deletions

View File

@@ -410,7 +410,7 @@ export default defineComponent({
return this.cachedResponses[this.currentRequestKey] || null;
},
currentQueryResults(): IResourceLocatorResultExpanded[] {
const results = this.currentResponse ? this.currentResponse.results : [];
const results = this.currentResponse?.results ?? [];
return results.map(
(result: INodeListSearchItems): IResourceLocatorResultExpanded => ({
@@ -648,6 +648,11 @@ export default defineComponent({
}
},
loadResourcesDebounced() {
if (this.currentResponse?.error) {
// Clear error response immediately when retrying to show loading state
delete this.cachedResponses[this.currentRequestKey];
}
void this.callDebounced(this.loadResources, {
debounceTime: 1000,
trailing: true,
@@ -664,6 +669,11 @@ export default defineComponent({
const paramsKey = this.currentRequestKey;
const cachedResponse = this.cachedResponses[paramsKey];
if (this.credentialsNotSet) {
this.setResponse(paramsKey, { error: true });
return;
}
if (this.requiresSearchFilter && !params.filter) {
return;
}