Description
The syncService.js script contains multiple reference errors and syntax issues:
- Undefined Functions:
syncAttendanceQueue calls getOutboxRecords(), removeFromOutbox(), and getAuth(), none of which are imported or declared in the module scope.
- Duplicate ESM Exports:
registerBackgroundSync is declared and exported twice (at lines 164 and 211).
- Stray Module Code: A block of queue flushing logic resides directly in the module body and ends with a stray closing brace
}, causing compilation errors.
Code Location
// Line 120, 144, and 124
const records = await getOutboxRecords(); // ReferenceError
await removeFromOutbox(records[i].id); // ReferenceError
const auth = getAuth(); // ReferenceError
Impact
The offline synchronization script cannot compile, preventing offline PWA data from successfully synchronizing back to the database when connectivity is restored.
Recommended Fix
- Clean up the bottom of the file by removing duplicate exports.
- Map
getOutboxRecords to getPendingActions and removeFromOutbox to removePendingAction (which are already imported).
- Import the initialized
auth client directly from @/lib/firebaseConfig.
Description
The
syncService.jsscript contains multiple reference errors and syntax issues:syncAttendanceQueuecallsgetOutboxRecords(),removeFromOutbox(), andgetAuth(), none of which are imported or declared in the module scope.registerBackgroundSyncis declared and exported twice (at lines 164 and 211).}, causing compilation errors.Code Location
lib/syncService.jsImpact
The offline synchronization script cannot compile, preventing offline PWA data from successfully synchronizing back to the database when connectivity is restored.
Recommended Fix
getOutboxRecordstogetPendingActionsandremoveFromOutboxtoremovePendingAction(which are already imported).authclient directly from@/lib/firebaseConfig.