@gallop.software/studio 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2183,32 +2183,43 @@ function StudioToolbar() {
2183
2183
  status: "processing",
2184
2184
  currentFile: imageKey.replace(/^\//, "")
2185
2185
  });
2186
- try {
2187
- const response = await fetch("/api/studio/sync", {
2188
- method: "POST",
2189
- headers: { "Content-Type": "application/json" },
2190
- body: JSON.stringify({ imageKeys: [imageKey] })
2191
- });
2192
- const data = await response.json();
2193
- if (!response.ok) {
2194
- if (data.error?.includes("R2 not configured") || data.error?.includes("CLOUDFLARE_R2")) {
2195
- setShowProgress(false);
2196
- setShowR2SetupModal(true);
2197
- return;
2186
+ let success = false;
2187
+ let lastError;
2188
+ for (let attempt = 0; attempt < 3 && !success; attempt++) {
2189
+ try {
2190
+ const response = await fetch("/api/studio/sync", {
2191
+ method: "POST",
2192
+ headers: { "Content-Type": "application/json" },
2193
+ body: JSON.stringify({ imageKeys: [imageKey] })
2194
+ });
2195
+ const data = await response.json();
2196
+ if (!response.ok) {
2197
+ if (data.error?.includes("R2 not configured") || data.error?.includes("CLOUDFLARE_R2")) {
2198
+ setShowProgress(false);
2199
+ setShowR2SetupModal(true);
2200
+ return;
2201
+ }
2202
+ lastError = data.error || `Failed: ${imageKey}`;
2203
+ } else if (data.pushed?.length > 0) {
2204
+ pushed++;
2205
+ success = true;
2206
+ } else if (data.errors?.length > 0) {
2207
+ for (const errMsg of data.errors) {
2208
+ lastError = errMsg;
2209
+ }
2210
+ } else {
2211
+ success = true;
2198
2212
  }
2199
- errors++;
2200
- errorMessages.push(data.error || `Failed: ${imageKey}`);
2201
- } else if (data.pushed?.length > 0) {
2202
- pushed++;
2203
- } else if (data.errors?.length > 0) {
2204
- errors++;
2205
- for (const errMsg of data.errors) {
2206
- errorMessages.push(errMsg);
2213
+ } catch (err) {
2214
+ lastError = `Network error: ${imageKey}`;
2215
+ if (attempt < 2) {
2216
+ await new Promise((resolve) => setTimeout(resolve, 500 * (attempt + 1)));
2207
2217
  }
2208
2218
  }
2209
- } catch (err) {
2219
+ }
2220
+ if (!success && lastError) {
2210
2221
  errors++;
2211
- errorMessages.push(`Network error: ${imageKey}`);
2222
+ errorMessages.push(lastError);
2212
2223
  }
2213
2224
  }
2214
2225
  setProgressState({
@@ -6482,4 +6493,4 @@ export {
6482
6493
  StudioUI,
6483
6494
  StudioUI_default as default
6484
6495
  };
6485
- //# sourceMappingURL=StudioUI-PERXOBGO.mjs.map
6496
+ //# sourceMappingURL=StudioUI-6Q7GX6IY.mjs.map