diff --git a/backend/firmware/service.py b/backend/firmware/service.py index 175ca19..732a2cc 100644 --- a/backend/firmware/service.py +++ b/backend/firmware/service.py @@ -390,9 +390,9 @@ def delete_firmware(doc_id: str) -> None: db.collection(COLLECTION) .where("hw_type", "==", hw_type) .where("channel", "==", channel) - .order_by("uploaded_at", direction="DESCENDING") - .limit(1) .stream() ) if remaining: + # Sort in Python to avoid needing a composite Firestore index + remaining.sort(key=lambda d: d.to_dict().get("uploaded_at", ""), reverse=True) remaining[0].reference.update({"is_latest": True}) diff --git a/frontend/src/cloudflash/CloudFlashPage.jsx b/frontend/src/cloudflash/CloudFlashPage.jsx index 8f14757..1894ead 100644 --- a/frontend/src/cloudflash/CloudFlashPage.jsx +++ b/frontend/src/cloudflash/CloudFlashPage.jsx @@ -767,7 +767,7 @@ function StepFlash({ firmware, flashType, serial, nvsSchema, onDone }) { await loaderRef.current.writeFlash({ fileArray, flashSize: "keep", flashMode: "keep", flashFreq: "keep", - eraseAll: false, compress: true, + eraseAll: flashType === FLASH_TYPE_FULL, compress: true, reportProgress(fileIndex, written, total) { const pct = (written / total) * 100; if (flashType === FLASH_TYPE_FULL) {