Skip to content

fix: clear + instant public/private toggle in the Muted list#14

Merged
DocNR merged 3 commits into
mainfrom
fix/mute-visibility-toggle
Jun 15, 2026
Merged

fix: clear + instant public/private toggle in the Muted list#14
DocNR merged 3 commits into
mainfrom
fix/mute-visibility-toggle

Conversation

@DocNR

@DocNR DocNR commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

The public/private toggle on each user in the Muted column was ambiguous and janky. This makes it labeled, self-documenting, and instant.

Before: a bare green 🔒 Lock (private) / gray 🔓 Unlock (public) icon — no label, no tooltip, and the icon showed the current state while clicking did the opposite. On a NIP-46 bunker, toggling ran fetch → decrypt → re-encrypt → sign behind a blocking spinner, and silently no-op'd (no feedback at all) if the private list failed to decrypt.

After:

  • Labeled control: 🌐 Public / 🔒 Private with a tooltip spelling out the action ("Only you can see this mute. Click to make it public."). Globe reads far better than "unlock"; the unexplained green is gone.
  • Coalesced optimistic toggle: the label flips instantly on every click; underneath we publish at most one mutation per settled target — extra clicks while a publish is in flight just update the pending target, so furious flipping never fans out into a cascade of signed kind-10000 events (each is a relay publish + a remote bunker sign). Reverts + toasts on failure.
  • No silent no-op: the two switch functions now toast when the pubkey isn't where expected (the decrypt-empty case) instead of returning quietly.

The data pathway itself was already correct (it moves the p-tag between public/private); this fixes the clarity and the feedback.

Ships as v26.14.1.

Test plan

  • A muted user shows Private or Public with the matching icon + a tooltip on hover
  • Click it → flips instantly (no multi-second frozen spinner); the mute actually switches
  • Rapidly flip back and forth → no pile-up of bunker sign prompts; lands on your last choice; net-zero flip publishes nothing extra
  • If your private list can't be read, you get a toast instead of a silent snap-back
  • Row still click-navigates to the profile; the toggle doesn't trigger navigation
  • Arabic (RTL): label + tooltip render correctly

npm run build clean, 867 tests pass, lint clean.

🤖 Generated with Claude Code

DocNR and others added 2 commits June 14, 2026 09:49
The Muted list showed a bare green Lock (private) / gray Unlock (public)
icon with no label or tooltip, and the icon showed the CURRENT state while
clicking did the OPPOSITE — genuinely ambiguous. Toggling was also janky on
a NIP-46 bunker: it ran fetch + decrypt + re-encrypt + sign behind a
blocking spinner, and silently no-oped (no feedback) if the private list
failed to decrypt.

- Labeled control: globe + 'Public' / lock + 'Private', with a tooltip
  spelling out the action ('Only you can see this... click to make public').
  Drops the unexplained green.
- Coalesced optimistic toggle: the label flips instantly on every click;
  underneath we publish at most one mutation per settled target (extra
  clicks while in flight just update the pending target), so rapid flipping
  never fans out into a cascade of signed events. Reverts + relies on the
  toast on failure.
- No silent no-op: the two switch functions now toast when the pubkey isn't
  where expected (decrypt-empty), instead of returning quietly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 14, 2026

Copy link
Copy Markdown

Deploying jank with  Cloudflare Pages  Cloudflare Pages

Latest commit: e9c9938
Status: ✅  Deploy successful!
Preview URL: https://df688029.jank-4ii.pages.dev
Branch Preview URL: https://fix-mute-visibility-toggle.jank-4ii.pages.dev

View logs

The coalesce loop's catch handler used `break`, which abandoned any
newer target a user had queued while a failing publish was in flight
(e.g. a slow NIP-46 bunker timing out the first switch). Drop the
break: the provider already surfaced the failure toast, so let the
loop honor the last click on its next iteration instead of silently
dropping the user's most recent intent. The loop still exits cleanly
when nothing is queued. Caught in code review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DocNR DocNR merged commit dfed9c5 into main Jun 15, 2026
2 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