Skip to content

fix(feeds): apply optimistic account votes to feed vote counts - #114

Merged
tomcasaburi merged 1 commit into
masterfrom
fix/feed-optimistic-vote-counts
Sep 3, 2026
Merged

fix(feeds): apply optimistic account votes to feed vote counts#114
tomcasaburi merged 1 commit into
masterfrom
fix/feed-optimistic-vote-counts

Conversation

@tomcasaburi

@tomcasaburi tomcasaburi commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • useFeed now selects the active account's accountsVotes entry and applies it to feed, bufferedFeed, and updatedFeed via addOptimisticVoteCountsToComments, the same helper and selector pattern already used by useComments and useReplies.
  • Voting on a post from a feed updates its upvoteCount/downvoteCount immediately instead of waiting for the community to publish new counts, so feed scores match comment pages.
  • Adds a feeds.test.ts regression test that sets a pending account vote and asserts the feed count changes; README and generated llms files updated.

Verification

  • oxfmt --check on the changed source files
  • Vitest src/hooks/feeds/feeds.test.ts (61 tests pass)
  • yarn build

Closes #113


Note

Low Risk
Localized UI-layer normalization in useFeed reusing an existing helper; no auth, publishing, or protocol changes.

Overview
useFeed now mirrors comment/reply hooks for vote scores. It reads the active account’s pending votes from the accounts store and runs addOptimisticVoteCountsToComments on feed, bufferedFeed, and updatedFeed (after moderation normalization), so upvoting from a feed bumps counts immediately instead of waiting for canonical community data.

A regression test in feeds.test.ts asserts that a pending account vote increases upvoteCount on a feed item. Docs (README.md, llms-full.txt) now list useFeed alongside the other hooks that apply optimistic vote adjustments.

Reviewed by Cursor Bugbot for commit 0c678d0. Bugbot is set up for automated code reviews on this repo. Configure here.

`useFeed` now applies the active account's pending votes to `upvoteCount` and `downvoteCount` with the same `addOptimisticVoteCountsToComments` helper used by `useComments` and `useReplies`, so voting from a feed updates the score immediately.
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 151e185e-d98a-4d1c-8fe0-4d151bf0abed

📥 Commits

Reviewing files that changed from the base of the PR and between 036c44f and 0c678d0.

📒 Files selected for processing (4)
  • README.md
  • llms-full.txt
  • src/hooks/feeds/feeds.test.ts
  • src/hooks/feeds/feeds.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tomcasaburi
tomcasaburi merged commit a081cfb into master Sep 3, 2026
8 checks passed
@tomcasaburi
tomcasaburi deleted the fix/feed-optimistic-vote-counts branch September 3, 2026 22:10
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.

useFeed does not apply the account's pending vote to upvote/downvote counts

1 participant