Skip to content

Clicking Follow on a locked account showed "Requested", but clicking again showed "Following" instead of cancelling the request.#28

Merged
cbl merged 1 commit into
mainfrom
fix/follow-requested
Apr 16, 2026
Merged

Clicking Follow on a locked account showed "Requested", but clicking again showed "Following" instead of cancelling the request.#28
cbl merged 1 commit into
mainfrom
fix/follow-requested

Conversation

@cbl

@cbl cbl commented Apr 16, 2026

Copy link
Copy Markdown
Member

Root cause

toggleFollow only checked followState (boolean) to decide follow vs unfollow. For locked accounts the API returns { following: false, requested: true } — so followState was false, and the second click called follow() again instead of unfollow() to cancel.

Fixed

  • useFollows.tstoggleFollow now treats requested as "engaged". If either following or requested is true, toggling calls unfollow() (cancel request). Optimistically clears requested in the relationship cache for instant UI feedback, with rollback on error.

Added

  • test/composables/useFollows.test.ts — 11 unit tests covering follow, unfollow, cancel pending request, optimistic state, API response handling, and error rollback.

@cbl cbl merged commit 92775b9 into main Apr 16, 2026
1 check passed
@cbl cbl deleted the fix/follow-requested branch April 16, 2026 11:45
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