diff --git a/src/features/labels/label-create-page.js b/src/features/labels/label-create-page.js index 3077d19..28ac70e 100644 --- a/src/features/labels/label-create-page.js +++ b/src/features/labels/label-create-page.js @@ -843,6 +843,9 @@ export function labelCreatePageData(store) { this.stopScanner(); this.scannerState.isLoading = true; + const shouldLogDecodeErrors = import.meta.env.DEV; + let lastDecodeErrorName = ''; + let lastDecodeErrorAt = 0; try { if (!this.scannerReader) { @@ -863,13 +866,20 @@ export function labelCreatePageData(store) { return; } - if (!error || error?.name === 'NotFoundException') { + if (error) { + // Continuous decode emits expected per-frame misses/errors before a valid barcode is found. + // Keep the modal quiet and only surface startup failures from the outer catch block. + if (shouldLogDecodeErrors) { + const errorName = String(error?.name || 'UnknownError'); + const now = Date.now(); + if (errorName !== lastDecodeErrorName || now - lastDecodeErrorAt > 2000) { + console.debug('[scanner] Ignoring frame decode error while scanning:', errorName, error?.message || ''); + lastDecodeErrorName = errorName; + lastDecodeErrorAt = now; + } + } return; } - - if (!this.scannerState.error) { - this.scannerState.error = this.normalizeScannerError(error); - } }, ); } catch (error) { diff --git a/src/features/stock/stock-detail-page.js b/src/features/stock/stock-detail-page.js index 72c7e46..f6541d4 100644 --- a/src/features/stock/stock-detail-page.js +++ b/src/features/stock/stock-detail-page.js @@ -5,6 +5,7 @@ import { patchStockItem, useStockItem, } from '../../api/stock.js'; +import { BrowserMultiFormatReader } from '@zxing/browser'; import { formatPrintErrorMessage, printItemLabel } from '../../api/labels.js'; import { fetchLocations } from '../../api/locations.js'; import { getRouteContext } from '../../app/router.js'; @@ -147,6 +148,7 @@ export function renderStockDetailPage() { class="form-control" type="text" x-model="identifierDraft" + @input="identifierState.error = ''" inputmode="numeric" autocomplete="off" placeholder="EAN / UPC / GTIN" @@ -160,8 +162,16 @@ export function renderStockDetailPage() { Save identifier Saving... + -
Point your camera at the barcode to fill the identifier field.
+