Repository navigation
fix: follow several people in a row without cancelling the earlier follows - #573
Merged
nunomaduro merged 1 commit intoOct 19, 2026
Conversation
…llows Follow buttons were plain Inertia visits, and Inertia cancels the visit in flight when the next one starts. Following a second person before the first answered left the first button on "Follow". Follows are now async visits, and each person's follow waits for the one before it to finish. Fixes dev-null-sh#559
rohitsasi720
force-pushed
the
fix/follow-several-in-a-row
branch
from
October 19, 2026 14:44
ebedbe6 to
e070523
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #559.
Problem
Following several people quickly from "Who to follow" only flipped the last button to Following. The others stayed on Follow, although the server had saved every follow: after a reload, all of them showed as followed.
FollowButtonis an Inertia<Link>, so every follow is a regular visit. Inertia sends regular visits through a single-request stream, and starting a new visit interrupts the one in flight (syncRequestStream.interruptInFlight()). The first follow was cancelled in the browser (net::ERR_ABORTED) before itsonSuccessran, so its button never flipped, but the server still saved the follow, so the button and the database disagreed.The same happened on every list with several follow buttons: followers and following, follow-back in notifications, and the empty log's suggestions.
Fix
FollowButtonnow sendsasyncvisits. These go through Inertia's non-interruptible stream, so follows run side by side and none cancels another, not even when you open a profile while a follow is on its way.Async visits don't cancel a double click either, so each person's follow now waits for the previous one to finish. A per-user
follow_pendingvalue lives in the existinguseSharedStatestore, andonBeforerefuses a new visit while it is set, so two buttons for the same person (the aside and their profile) wait for each other too. The button getsaria-disabledmeanwhile and keeps its size, so nothing shifts.Stars and saves already work this way, through
useHttp. This keeps follows on the redirect-back visits they already use, so nothing changes on the server.Before and after
production)Screen.Recording.2026-10-19.at.3.58.21.PM.mov
Screen.Recording.2026-10-19.at.3.47.06.PM.mov
Tests
tests/Unit/FollowState.test.tsx: two suggestions followed in a row both send async visits and both end up showing "Following", and a second click on a follow still on its way sends nothing. Both tests fail onproductionand pass here, and all 15 tests in the file pass.bun run test:unit,bun run test:lint,bun run test:types, Pint, Rector, PHPStan and the full Pest suite (2,951 tests) pass locally. Coverage didn't run because I have no PCOV or Xdebug, but there is no PHP change.productionthe first two requests are aborted and their buttons stay on Follow while all three are saved; on this branch all three requests complete and all three buttons show Following. Checked by hand and with a Playwright script that compares each button with the database.tests/Unit/*.test.tsxfiles don't run in CI yet (test:unitonly globs*.test.ts, see #492), so I ran this one withbunx vp test run tests/Unit/FollowState.test.tsx.