-
Notifications
You must be signed in to change notification settings - Fork 0
fix(forms): add delay before resetting scan state on trigger release #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes a race condition where the trigger release event was processed before the barcode store subscription could fire, causing scanned barcode data to be discarded. This affected Windows Chrome more than macOS due to different JavaScript event loop timing. The fix adds a 150ms delay before resetting isScanningRef on trigger release, giving the barcode store subscription time to process any pending barcode data. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
Replace timing-based race condition fix with deterministic approach: - Track barcode count when scan starts (startCount) - Subscription compares barcodes.length > startCount - Session stays active 2s after trigger release to catch late data - New trigger during cooldown cancels old session and starts fresh This eliminates timing dependency entirely - comparison is deterministic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
Don't call dm.setMode() immediately on trigger release - this was aborting the CS108 scan mid-transmission causing truncated reads. Now mode switch happens: - Immediately after barcode data received (via endScanSession) - OR after 2s timeout if no data (fallback cleanup) This gives the CS108 time to finish transmitting barcode data. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Give CS108 500ms to finish transmitting data after trigger release - Switch modes after 500ms, keep session open 1.5s more for late data - End immediately on clean read (endScanSession cancels timeouts) Total timing: 500ms grace + 1.5s late data window = 2s max Clean read: immediate mode switch, no waiting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
Add onMouseDown with preventDefault to stop the tag input from losing focus when clicking the Scan button. This prevents the button from being disabled before the click event fires. Applied to both AssetForm and LocationForm. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
Don't switch modes until data arrives or 2s timeout - more forgiving for slow machines. Mode switch only happens via: - endScanSession() when data arrives (immediate) - 2s timeout cleanup (fallback) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
Remove stripAimIdentifier - was causing empty data on some machines. Now passes raw barcode.data directly, same as BarcodeScreen displays. Also switched from subscription to reactive state for barcode detection which is more reliable on slow machines. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
Re-add stripAimIdentifier to extract data after QR prefix (Q]Q1...). Added console.debug logging to help diagnose issues on Tim's machine. Example: "Q]Q1000000000000000000000130" -> "000000000000000000000130" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
93b789d to
2d1cefa
Compare
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://app.preview.trakrf.id |
Summary
isScanningRefon trigger releaseRoot Cause
When scanning barcodes in Asset/Location forms via hardware trigger:
isScanningRef.current = trueuseBarcodeStoreisScanningRef.current = false← happened too fastisScanningRef.current→ false, discards barcode!Test plan
🤖 Generated with Claude Code