Skip to content

enhance(logistics): add offline caching to qr code handoff generator (#152)#214

Merged
johdanike merged 2 commits into
SwiftChainn:mainfrom
QueenColly:enhance/offline-qr-handoff
Jun 29, 2026
Merged

enhance(logistics): add offline caching to qr code handoff generator (#152)#214
johdanike merged 2 commits into
SwiftChainn:mainfrom
QueenColly:enhance/offline-qr-handoff

Conversation

@QueenColly

Copy link
Copy Markdown
Contributor

Closes #152

Summary of Work Done:
Implemented offline-first functionality for the QR Code Handoff Generator to ensure drivers can complete handoffs in zero-connectivity zones. The implementation strictly follows the Component -> Hook -> Service architectural pattern.

Implementation Details:

Service Layer (services/offlineStorageService.ts): Built a service using IndexedDB/localStorage to cache the handoff payload fetched from the live backend API (no mock objects used). Also added a queue mechanism to temporarily store successful scan confirmations.

Hook Layer (hooks/useOfflineQr.ts): Created a custom hook that attempts to fetch the live payload, falls back to the cached service data on network timeout, and listens for the window online event to sync queued scan confirmations back to the server.

Component Layer (components/logistics/QrGenerator.tsx): Refactored the UI to consume useOfflineQr. It seamlessly renders the qrcode.react component using the locally cached state when the device is entirely offline.

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@QueenColly Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@johdanike johdanike merged commit 4adfcd0 into SwiftChainn:main Jun 29, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Offline-Ready QR Code Handoff Queuing

2 participants