Skip to content

fix(flashcard): close the BoltCard screen on Remove card instead of showing "No Cards Found" - #756

Merged
islandbitcoin merged 2 commits into
mainfrom
jabariennis/flashcard-v1-remove-pops
Oct 6, 2026
Merged

islandbitcoin merged 2 commits into
mainfrom
jabariennis/flashcard-v1-remove-pops

Conversation

@islandbitcoin

@islandbitcoin islandbitcoin commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What

"Remove card" on the BoltCard (Flashcard v1) screen cleared the card but left the screen up, which then rendered its empty state: "No Cards Found / Tap a Flashcard to add it here". That state is for arriving without a card, not for having just removed one. The Cashu card screen already closes on removal; this makes the v1 screen do the same.

How

  • Flashcard (the v1 card component) takes an onRemove prop instead of calling resetFlashcard itself.
  • CardScreen's handler clears the card and pops. The popped screen stays mounted for its exit animation with the card already gone, so a removing flag renders nothing in that window instead of the empty state.
  • The isFocused() check before the pop is defensive, for a press that lands mid-transition. The signed-out beforeRemove reset never goes through this handler, and the Remove button is hidden while signed out.
  • Opening the Card screen with no card still shows the empty state (unchanged).

Tests

__tests__/screens/card-remove.spec.tsx, against the real FlashcardProvider and the real screen:

  • Remove card clears the card, calls goBack once, and the empty state is not rendered on the popped screen.
  • A press that lands while the screen is not focused clears the card and does not pop.
  • Opening without a card shows "No Cards Found" and does not pop.

The two <Flashcard> renders in flashcard-tap-call-sites.spec.tsx pass the new prop, so yarn tsc:check is clean (it was not on the first push). Pre-existing lint warnings in card.tsx and the conditional-hook errors in Flashcard.tsx are untouched; CI lints changed lines only.

Field note

Found on the Pixel 8 Pro during the 0.8.0 Flashcard v1 pass on 2026-10-06. Behaviour is unchanged since 0.7.2, so this is a fix, not a regression.

🤖 Generated with Claude Code

Dread and others added 2 commits October 6, 2026 16:25
…howing "No Cards Found"

"Remove card" on the BoltCard screen cleared the card and nothing else, so
the screen stayed up and fell through to its empty state — "No Cards
Found / Tap a Flashcard to add it here" — which exists for arriving
without a card, not for having just removed one. The Cashu card screen
already closes on removal; this makes the BoltCard screen do the same.

The Flashcard component now takes an onRemove prop, and the screen's
handler clears the card then pops, only while focused, so a removal on
the way out cannot pop a second screen. Opening the screen without a
card still shows the empty state.

Field-found on the Pixel 8 Pro during the 0.8.0 Flashcard v1 pass,
2026-10-06; the behaviour is unchanged since 0.7.2.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…the tsc break

Review fixes for #756.

- The popped screen stays mounted for its exit animation with the card
  already cleared, so it rendered the "No Cards Found" empty state for the
  ~300 ms slide — the frame the fix exists to remove. A `removing` flag
  renders nothing in that window; the empty state stays for arriving
  without a card. The spec now asserts the empty state is absent after
  Remove, which it did not before.
- `Flashcard`'s new required `onRemove` prop broke `yarn tsc:check`: the
  two renders in flashcard-tap-call-sites.spec.tsx did not pass it. Jest
  does not type-check, so the suite still passed.
- The focus-guard comment borrowed the Cashu screen's rationale, which
  does not apply here: the signed-out `beforeRemove` reset never reaches
  `onRemove`, and the Remove button is hidden while signed out. The
  comment now says the guard is defensive, and the second test is named
  for what it pins.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@islandbitcoin
islandbitcoin merged commit 250aed0 into main Oct 6, 2026
9 checks passed
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.

1 participant