From 7b7940189e90c49279274bad1b7893f3f08209bd Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Mon, 28 Apr 2025 10:18:15 +0000 Subject: [PATCH] chore(qr): add unconditional debug panel and simplify onInit for event binding test - Add always-visible debug panel to QRScannerDialog to confirm template updates - Simplify onInit signature and add alert to verify @init event is firing - Refine error handling in onInit for clarity during debugging --- src/components/QRScanner/QRScannerDialog.vue | 40 ++++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/components/QRScanner/QRScannerDialog.vue b/src/components/QRScanner/QRScannerDialog.vue index 032286e1..aca9248c 100644 --- a/src/components/QRScanner/QRScannerDialog.vue +++ b/src/components/QRScanner/QRScannerDialog.vue @@ -201,6 +201,10 @@
{{ debugMessage }}
+ +
+ DEBUG PANEL: If you see this, the template is updating. +
@@ -278,9 +282,9 @@ export default class QRScannerDialog extends Vue { } } - async onInit(promise: Promise, attempt = 1): Promise { - alert("onInit called, attempt: " + attempt); - this.debugMessage = "onInit called, attempt: " + attempt; + async onInit(promise: Promise) { + alert("onInit called"); + this.debugMessage = "onInit called"; let timeoutHit = false; const timeout = setTimeout(() => { timeoutHit = true; @@ -304,25 +308,19 @@ export default class QRScannerDialog extends Vue { clearTimeout(timeout); alert("Promise rejected: " + (error instanceof Error ? error.message : error)); this.debugMessage = "Promise rejected: " + (error instanceof Error ? error.message : error); - if (attempt < 3) { - // Retry after a short delay - setTimeout(() => this.onInit(promise, attempt + 1), 1500); - this.initializationStatus = `Retrying camera initialization (attempt ${attempt + 1})...`; - return; - } - const wrappedError = - error instanceof Error ? error : new Error(String(error)); - this.error = wrappedError.message; - this.cameraStatus = "Error"; - if (this.onError) { - this.onError(wrappedError); + if (error instanceof Error) { + this.error = error.message; + this.cameraStatus = "Error"; + if (this.onError) { + this.onError(error); + } + logger.error("Error initializing QR scanner:", { + error: error.message, + stack: error.stack, + name: error.name, + type: error.constructor.name, + }); } - logger.error("Error initializing QR scanner:", { - error: wrappedError.message, - stack: wrappedError.stack, - name: wrappedError.name, - type: wrappedError.constructor.name, - }); } finally { this.isInitializing = false; }