Skip to content

Flashcard import: switching back to the Paste tab silently wipes the deck built on other tabs #183

@Jose-Gael-Cruz-Lopez

Description

@Jose-Gael-Cruz-Lopez

Severity: Medium
Labels: bug, data-integrity, frontend, P2
Location: frontend/src/components/flashcards/tabs/PasteTab.tsx:57-62 (live-reparse effect); conditional tab mounting in frontend/src/components/flashcards/FlashcardImportModal.tsx:131-135

Description

All import tabs share one cards array via setCards, and tabs are conditionally mounted. PasteTab's live re-parse effect runs on mount; with empty local text it hits if (!text...) { onCards([]); return; }, clearing the shared deck.

Steps to reproduce

  1. Open Import; on Upload/URL/AI/Photo build a parsed-cards table.
  2. Click the "Paste" tab.
  3. The table empties — all parsed/edited cards are lost with no warning.

Expected vs actual

  • Expected: switching tabs preserves the working deck.
  • Actual: re-entering Paste unconditionally clears it.

Suggested fix

Don't emit onCards([]) from the empty/mount path (gate on a "user has typed" flag), or keep tabs mounted (hidden) so the effect doesn't re-fire on switch.

Acceptance criteria

  • Navigating between import tabs never clears already-parsed cards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium prioritybugSomething isn't workingdata-integrityCorrectness of stored/served datafrontendFrontend / UI

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions