diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-02 11:11:53 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-02 11:12:00 +0900 |
| commit | 7ca9941982a7d7a4c126d215770ce71ad2f7f427 (patch) | |
| tree | 0178b48094e9b7b143fd47c4d8479d3d588bb1d7 /src/client/pages/DeckCardsPage.test.tsx | |
| parent | 8f1a08fefee3a8e928baec741c830a88a4cd7200 (diff) | |
| download | kioku-7ca9941982a7d7a4c126d215770ce71ad2f7f427.tar.gz kioku-7ca9941982a7d7a4c126d215770ce71ad2f7f427.tar.zst kioku-7ca9941982a7d7a4c126d215770ce71ad2f7f427.zip | |
feat(client): read decks/cards/study from IndexedDB first
Switch deckAtom, cardsByDeckAtomFamily, noteTypesAtom, and studyDataAtom
to a stale-while-revalidate pattern: read from IndexedDB synchronously,
trigger sync in the background, and refetch on sync_complete. When local
is empty, await a single bootstrap pull before deciding there's no data.
Add study-builder to assemble StudyCards from LocalCard + Note + NoteType
+ field values, replacing the server /study endpoint dependency. The
study session can now run end-to-end offline.
Disable submit on all write modals when offline since writes still
require the server. Add a "Showing cached data" hint to the sync status
indicator. Drop cacheStudyCards (cards arrive via regular sync pull now)
and update page tests to reflect that lists no longer refresh by hitting
the GET API.
Diffstat (limited to 'src/client/pages/DeckCardsPage.test.tsx')
| -rw-r--r-- | src/client/pages/DeckCardsPage.test.tsx | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/client/pages/DeckCardsPage.test.tsx b/src/client/pages/DeckCardsPage.test.tsx index c498056..0ea9822 100644 --- a/src/client/pages/DeckCardsPage.test.tsx +++ b/src/client/pages/DeckCardsPage.test.tsx @@ -417,12 +417,9 @@ describe("DeckCardsPage", () => { expect(screen.queryByRole("dialog")).toBeNull(); }); - it("deletes note and refreshes list on confirmation", async () => { + it("submits the note delete via the delete endpoint", async () => { const user = userEvent.setup(); - mockCardsGet.mockResolvedValue({ - cards: [mockCards[1]], - }); mockNoteDelete.mockResolvedValue({ ok: true, json: async () => ({ success: true }), @@ -457,10 +454,6 @@ describe("DeckCardsPage", () => { expect(mockNoteDelete).toHaveBeenCalledWith({ param: { deckId: "deck-1", noteId: "note-1" }, }); - - await waitFor(() => { - expect(screen.getByText("(1)")).toBeDefined(); - }); }); it("displays error when delete fails", async () => { @@ -568,10 +561,9 @@ describe("DeckCardsPage", () => { ).toBeDefined(); }); - it("deletes note and refreshes list when confirmed", async () => { + it("submits the note delete via the delete endpoint", async () => { const user = userEvent.setup(); - mockCardsGet.mockResolvedValue({ cards: [] }); mockNoteDelete.mockResolvedValue({ ok: true, json: async () => ({ success: true }), @@ -603,10 +595,6 @@ describe("DeckCardsPage", () => { expect(mockNoteDelete).toHaveBeenCalledWith({ param: { deckId: "deck-1", noteId: "note-1" }, }); - - await waitFor(() => { - expect(screen.getByText("No cards yet")).toBeDefined(); - }); }); it("displays note preview from normal card content", () => { |
