Allow saved searches to be edited or deleted on error

E.g., "too many SQL variables"

Fixes #1734
This commit is contained in:
Dan Stillman 2020-02-29 16:24:34 -05:00
parent 6170832c44
commit 691d0ca9d1
3 changed files with 23 additions and 4 deletions

View file

@ -272,8 +272,17 @@ Zotero.CollectionTreeRow.prototype.getSearchResults = Zotero.Promise.coroutine(f
}
if(!Zotero.CollectionTreeCache.lastResults) {
var s = yield this.getSearchObject();
Zotero.CollectionTreeCache.lastResults = yield s.search();
let s = yield this.getSearchObject();
Zotero.CollectionTreeCache.error = false;
try {
Zotero.CollectionTreeCache.lastResults = yield s.search();
}
catch (e) {
Zotero.logError(e);
Zotero.CollectionTreeCache.lastResults = [];
// Flag error so ZoteroPane::onCollectionSelected() can show a message
Zotero.CollectionTreeCache.error = true;
}
Zotero.CollectionTreeCache.lastTreeRow = this;
}

View file

@ -1190,8 +1190,17 @@ var ZoteroPane = new function()
Zotero.Prefs.clear('lastViewedFolder');
ZoteroPane_Local.displayErrorMessage();
};
this.itemsView.onRefresh.addListener(() => this.setTagScope());
this.itemsView.onLoad.addListener(() => Zotero.uiIsReady());
this.itemsView.onRefresh.addListener(() => {
this.setTagScope();
});
this.itemsView.onLoad.addListener(() => {
// Show error if items list couldn't loaded (e.g., bad search), as set in
// Zotero.CollectionTreeRow::getSearchResults()
if (Zotero.CollectionTreeCache.error) {
this.setItemsPaneMessage(Zotero.getString('pane.items.loadError'));
}
Zotero.uiIsReady();
});
// If item data not yet loaded for library, load it now.
// Other data types are loaded at startup

View file

@ -282,6 +282,7 @@ pane.items.intro.text2 = View the [Quick Start Guide] to learn how to begin buil
pane.items.intro.text3 = Already using %S on another computer? [Set up syncing] to pick up right where you left off.
pane.items.loading = Loading items…
pane.items.loadError = Error loading items list
pane.items.columnChooser.moreColumns = More Columns
pane.items.columnChooser.secondarySort = Secondary Sort (%S)
pane.items.attach.link.uri.unrecognized = Zotero did not recognize the URI you entered. Please check the address and try again.