mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-02-01 13:22:04 -08:00
fix error handling for fetching div ids
This commit is contained in:
parent
57d05543df
commit
580711cdac
3 changed files with 21 additions and 5 deletions
|
|
@ -409,13 +409,17 @@ class Clusterize {
|
|||
|
||||
async #insertToDOM() {
|
||||
if (!this.options.cluster_height || !this.options.cluster_width) {
|
||||
// We need to fetch a single item so that we can calculate the dimensions
|
||||
// for our list.
|
||||
const rows = await this.fetchData(0, 1);
|
||||
if (!Array.isArray(rows) || !rows.length) {
|
||||
console.error(`Failed to fetch data for idx range (0, 1)`);
|
||||
// This implies there is no data for this list. Not an error.
|
||||
// Errors should be handled in the fetchData callback, not here.
|
||||
this.#html(this.#generateEmptyRow().join(""));
|
||||
return;
|
||||
} else {
|
||||
this.#exploreEnvironment(rows, this.#cache);
|
||||
// Remove the temporary item from the data since we calculated its size.
|
||||
this.#html(this.#generateEmptyRow("Loading...").join(""));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,7 +427,10 @@ class ExtraNetworksTab {
|
|||
const timeout = EXTRA_NETWORKS_REQUEST_GET_TIMEOUT_MS;
|
||||
try {
|
||||
const response = await requestGetPromise(url, payload, timeout);
|
||||
return response.response;
|
||||
if (response.response.missing_div_ids.length) {
|
||||
console.warn(`Failed to fetch multiple div_ids: ${response.response.missing_div_ids}`);
|
||||
}
|
||||
return response.response.data;
|
||||
} catch (error) {
|
||||
console.error(JSON.stringify(error));
|
||||
return {};
|
||||
|
|
@ -447,7 +450,10 @@ class ExtraNetworksTab {
|
|||
const timeout = EXTRA_NETWORKS_REQUEST_GET_TIMEOUT_MS;
|
||||
try {
|
||||
const response = await requestGetPromise(url, payload, timeout);
|
||||
return response.response;
|
||||
if (response.response.missing_div_ids.length) {
|
||||
console.warn(`Failed to fetch multiple div_ids: ${response.response.missing_div_ids}`);
|
||||
}
|
||||
return response.response.data;
|
||||
} catch (error) {
|
||||
console.error(JSON.stringify(error));
|
||||
return {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue