feat(pwa): Offline study logging & automatic synchronization queue

オープン
#277 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
firebase, react, typescript

調査の方向性

Start by reading src/components/newnote/hooks/use-note-submission.ts and src/firebase.ts, then inspect the existing /api/groups/post-note flow and test setup. Define the queue in src/utils/offline-sync-queue.ts and the status UI in src/components/common/offline-banner.tsx. Done means offline notes are retained without a blocking error, sync automatically after reconnection, offline status is visible, and existing unit and E2E tests pass.

索引モデルが issue の本文から書いたものです。

説明

good first issue hacktoberfest help wanted
Problem Statement

Currently, posting a scripture note or completing daily study requires an active network connection (POST /api/groups/post-note). When users study offline (e.g., on airplanes, subways, or in areas with poor reception), submissions fail immediately with a network error toast, disrupting their study streak and workflow.

Proposed Solution

Implement an offline mutation queue (Outbox Pattern) for study notes and streak check-ins:

  1. Offline Note Queueing (IndexedDB / localStorage):
    • When offline (!navigator.onLine or API call failure due to network), save the pending note submission payload into a local queue.
    • Show a non-blocking toast: "Saved offline. Your streak and note will sync automatically once connected."
  2. Auto-sync on Reconnection:
    • Listen to window.addEventListener('online') (or Service Worker Sync if supported).
    • Drain the offline queue in chronological order, replaying the POST /api/groups/post-note requests.
  3. Offline Status UI:
    • Add a subtle offline banner or badge in the navigation/dashboard when disconnected.
  4. Firestore Offline Persistence:
    • Ensure Firestore's persistentLocalCache or IndexedDB cache is properly initialized in src/firebase.ts so users can browse previously fetched scriptures and notes while offline.
Target Files
  • src/components/newnote/hooks/use-note-submission.ts
  • src/firebase.ts
  • src/utils/offline-sync-queue.ts (New utility / store)
  • src/components/common/offline-banner.tsx (New component)
Acceptance Criteria
  • Submitting a note while offline stores the draft locally and does not show a blocking error.
  • When internet connectivity is restored, the queued note is automatically sent to /api/groups/post-note and updates the user's streak.
  • Offline status is clearly communicated in the UI.
  • Existing unit and E2E tests pass.
主要言語
TypeScript
スター
10
フォーク
2
平均マージ
1日 9時間
マージ済み PR(30日)
39

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ScriptureHabit/scripture-habit のほかの issue

ScriptureHabit/scripture-habit の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。