SkateSpots/src
shakespeare.diy 29d41b81eb Stash: prevent data-loss clobber on save + confirm before deleting gear
Audited the Stash — a private, NIP-44-encrypted, Amber-sensitive surface.

DATA-SAFETY FIX (the important one):
The stash is a single replaceable event whose encrypted content is the WHOLE
item list, so every add/update/remove rewrites the entire event. The mutations
built the new list from the `stash` closure value — but that's legitimately
`undefined` before the decrypt completes, and with Amber the read query is
gated / staleTime:Infinity, so it may never have been decrypted at mutation
time. Result: adding one item while `stash` was empty/undefined could publish a
list containing only that item and silently WIPE all existing gear.

Fix: mutations now call `fetchLatestStash()` — a fresh relay fetch + decrypt of
the current stash immediately before saving — and build the new list on top of
that. It falls back to React Query cache (never an empty list) on failure, and
throws rather than risk a clobber if it truly can't load. saveStash also writes
the just-published value straight into the cache to keep reads consistent.

The extra decrypt per mutation is an acceptable Amber tradeoff: a mutation is
already a deliberate write (encrypt + sign prompt), and data integrity beats
prompt count.

UX:
• Delete now asks for confirmation via an AlertDialog (item name + a note that
  public items get unlisted). Previously a single tap wiped an item outright —
  destructive and, with Amber, a surprise signer prompt.

The rest of StashPage (login gate, encryption-required state, distinct
wishlist/stash/filtered empty states, skeletons, rarity cards, grid/list) is
already excellent — left as-is.

Bumps to 1.2.23 (Android versionCode 10223 auto-derived).

Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
2026-09-07 20:31:48 +07:00
..
components Wallet UX polish: elegant recovery-phrase reveal, separate amounts, loading states 2026-09-07 20:20:51 +07:00
contexts fix: restore full skate-spots source tree from misplaced src/src/ copy 2026-06-15 22:18:28 +07:00
hooks Stash: prevent data-loss clobber on save + confirm before deleting gear 2026-09-07 20:31:48 +07:00
i18n Remove non-functional NoGood Radio everywhere (unused hook, i18n keys, onboarding refs) 2026-08-27 10:04:50 +07:00
lib fix(amber): stop passive decryption from storming Amber on navigation (1.2.16) 2026-09-07 14:57:35 +07:00
pages Stash: prevent data-loss clobber on save + confirm before deleting gear 2026-09-07 20:31:48 +07:00
test Fix 78 pre-existing TypeScript errors surfaced by npm test 2026-09-03 21:18:02 +07:00
App.test.tsx New project created with Shakespeare 2026-06-15 19:49:07 +07:00
App.tsx Add first-launch beta disclaimer dialog + footer BETA badge 2026-08-01 12:14:42 +07:00
AppRouter.tsx Add Skater profiles (kind 35000) + /skaters directory 2026-09-02 20:58:51 +07:00
index.css Hide visible scrollbar on mobile for a clean, app-like feel 2026-09-03 14:49:43 +07:00
main.tsx Fix native white screen: relative asset base + boot crash guard 2026-07-24 18:21:57 +07:00
vite-env.d.ts fix: restore full skate-spots source tree from misplaced src/src/ copy 2026-06-15 22:18:28 +07:00