generated from coulomb/repo-seed
Refresh erroneous documents to detect server-side fixes
- Include erroneous server documents in auto-refresh - Documents can transition from ERRONEOUS to SHIPPABLE when fixed on server - Clear error message when document status becomes non-erroneous - Properly handle status transitions in refresh flow Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -987,10 +987,13 @@ async function handleRefreshAll() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find all documents that have been uploaded and are still visible
|
||||
// Find all documents that have been uploaded and might change status
|
||||
// Include erroneous docs - they can be fixed on the server and become shippable
|
||||
const uploadedDocs = pdfQueue.filter(p =>
|
||||
p.binectDocumentId &&
|
||||
(p.binectStatus === 'in_basket' || p.binectStatus === 'in_production')
|
||||
(p.binectStatus === 'in_basket' ||
|
||||
p.binectStatus === 'in_production' ||
|
||||
(p.binectStatus === 'failed' && p.binectStatusCode === 7)) // Erroneous on server
|
||||
);
|
||||
|
||||
if (uploadedDocs.length === 0) {
|
||||
@@ -1079,9 +1082,10 @@ async function handleRefreshStatus(id: string) {
|
||||
pdf.binectStatus = newStatus;
|
||||
pdf.binectStatusCode = result.status;
|
||||
pdf.binectStatusText = result.statusText;
|
||||
if (result.price) pdf.price = result.price;
|
||||
if (result.price !== undefined) pdf.price = result.price;
|
||||
if (result.recipientAddress) pdf.recipientAddress = result.recipientAddress;
|
||||
if (result.errorDetails) pdf.errorMessage = result.errorDetails;
|
||||
// Clear or set error message based on status
|
||||
pdf.errorMessage = result.errorDetails || undefined;
|
||||
renderPDFList();
|
||||
|
||||
} catch (error) {
|
||||
|
||||
@@ -303,6 +303,11 @@ export async function updatePDFStatus(
|
||||
entry.contentHash = meta.contentHash;
|
||||
}
|
||||
|
||||
// Clear error message when transitioning to non-erroneous state
|
||||
if (status !== 'failed' && entry.errorMessage) {
|
||||
entry.errorMessage = undefined;
|
||||
}
|
||||
|
||||
// Set timestamps based on status
|
||||
if (status === 'in_basket' && !entry.uploadedAt) {
|
||||
entry.uploadedAt = Date.now();
|
||||
|
||||
Reference in New Issue
Block a user