Skip to content

feat(offline): IndexedDB task-config store with sync-on-reconnect (#421)#554

Open
Rufai-Ahmed wants to merge 1 commit into
SoroLabs:mainfrom
Rufai-Ahmed:feat/offline-task-config-sync
Open

feat(offline): IndexedDB task-config store with sync-on-reconnect (#421)#554
Rufai-Ahmed wants to merge 1 commit into
SoroLabs:mainfrom
Rufai-Ahmed:feat/offline-task-config-sync

Conversation

@Rufai-Ahmed

Copy link
Copy Markdown

Summary

Adds an offline-first, IndexedDB-backed store for task configurations that automatically syncs when connectivity is restored (#421).

What's included

  • src/lib/offline/taskConfigDb.ts — a small, dependency-free promisified wrapper over IndexedDB: saveTaskConfig (stored as pending), getTaskConfig, getAllTaskConfigs, getPendingConfigs, markConfigSynced, deleteTaskConfig, and syncTaskConfigs(push).
  • src/lib/offline/useOfflineTaskConfig.ts — a React hook that persists configs offline and flushes them through an injected push function whenever the app comes (back) online. Exposes configs, pendingCount, online, syncing, saveConfig, sync.

Design notes

  • Reuses the existing useOnlineStatus primitive (src/lib/network) rather than reinventing online detection.
  • Sync is per-item resilient: a failed push leaves that config pending for the next attempt and never aborts the rest of the batch.
  • The transport (push) is injected, so the store is decoupled from the actual task-registration/RPC call.

Testing

  • 9 Jest tests across the store and hook (offline save → reconnect → sync, partial-failure handling, immediate online sync), all passing.
  • Added a guarded structuredClone polyfill to jest.setup.js (jsdom doesn't expose it; fake-indexeddb needs it) and fake-indexeddb as a dev dependency.

Follow-ups

Wire push to the real task-registration call and surface pendingCount in the existing OfflineStatusBar.

Closes #421

@Rufai-Ahmed Rufai-Ahmed reopened this Jun 26, 2026
@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@Rufai-Ahmed 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

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.

[Frontend] Develop Offline-First Task Configuration Sync

1 participant