rubyforgood / rubyforgood/awbw

Subscriptions index runs count queries on full-page requests that never use them

Open Beginner friendly
#2,088 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
15
Forks
26
Avg merge
12h 42m
Merged PRs (30d)
242

Description

🤖 From Claude:

Found during review of the topic-subscriptions branch (maebeale/interested-registrant-status).

@active_count / @unsubscribed_count (plus the filtered base scope) are computed before the turbo_frame_request? branch in TopicSubscriptionsController#index, but the full-page render only shows the shell and skeleton — the counts appear only in the topic_subscriptions_results frame. The documented lazy-frame pattern (and GrantsController) does this work only inside the frame branch, so every full-page load currently pays two unused COUNT queries.

Minor efficiency/pattern-adherence fix: guard the count/scope work behind the frame branch (or compute lazily) to match the pattern.

Location: app/controllers/topic_subscriptions_controller.rb (index, count lines ~13–14).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in app/controllers/topic_subscriptions_controller.rb at TopicSubscriptionsController#index and compare its lazy-frame handling with GrantsController. Check the full-page and turbo-frame branches, then ensure count and filtered-scope work occurs only when the results frame needs it while the frame still renders the counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.