aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/sync/queue.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-02 10:41:12 +0900
committernsfisis <nsfisis@gmail.com>2026-05-02 10:41:12 +0900
commit8f1a08fefee3a8e928baec741c830a88a4cd7200 (patch)
tree19101c992c19e283e4fa30abafcd58cfeb401cc9 /src/client/sync/queue.ts
parent90b06b22e1e468cd19358536919a38ab6377fd23 (diff)
downloadkioku-8f1a08fefee3a8e928baec741c830a88a4cd7200.tar.gz
kioku-8f1a08fefee3a8e928baec741c830a88a4cd7200.tar.zst
kioku-8f1a08fefee3a8e928baec741c830a88a4cd7200.zip
feat(study): submit reviews offline via IndexedDB
Move FSRS scheduling to a shared module so the client can compute next card state without contacting the server. StudyPage now writes the updated card and review log straight to IndexedDB and lets the existing sync engine push them on reconnect, instead of POSTing to /api/decks/:deckId/study/:cardId. Online sessions still trigger a sync immediately so server-side aggregates stay fresh; offline sessions accumulate in pendingCountAtom until the next online tick. The legacy study POST route is preserved for backwards compatibility. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/client/sync/queue.ts')
-rw-r--r--src/client/sync/queue.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/client/sync/queue.ts b/src/client/sync/queue.ts
index 984edc3..b097159 100644
--- a/src/client/sync/queue.ts
+++ b/src/client/sync/queue.ts
@@ -246,6 +246,14 @@ export class SyncQueue {
}
/**
+ * Notify listeners that pending changes may have been added externally
+ * (e.g., after writing to IndexedDB outside of the sync flow).
+ */
+ async notifyChanged(): Promise<void> {
+ await this.notifyListeners();
+ }
+
+ /**
* Mark items as synced after successful push
*/
async markSynced(results: {