Local API: Load library items if not yet loaded

Fixes #4244
This commit is contained in:
Dan Stillman 2024-06-19 00:28:25 -04:00
parent e00b754fce
commit ecfc217ce9

View file

@ -117,6 +117,12 @@ class LocalAPIEndpoint {
? Zotero.Groups.getLibraryIDFromGroupID(parseInt(requestData.pathParams.groupID))
: Zotero.Libraries.userLibraryID;
let library = Zotero.Libraries.get(requestData.libraryID);
if (!library.getDataLoaded('item')) {
Zotero.debug("Waiting for items to load for library " + library.libraryID);
await library.waitForDataLoad('item');
}
let response = await this.run(requestData);
if (response.data) {
let dataIsArray = Array.isArray(response.data);