Skip to content

fix(rewards): add retry on snapshot load failure + tab-switch logging#768

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
jwalin-shah:fix/rewards-shell-retry
Apr 22, 2026
Merged

fix(rewards): add retry on snapshot load failure + tab-switch logging#768
senamakel merged 1 commit into
tinyhumansai:mainfrom
jwalin-shah:fix/rewards-shell-retry

Conversation

@jwalin-shah
Copy link
Copy Markdown
Contributor

Summary

First slice of #712 (Rewards stabilization). Tight, review-in-one-sitting change on the Rewards page shell so follow-up PRs can focus on per-tab flows and E2E.

  • Retry button in the Community tab error banner — refetches the snapshot, re-enables on success, disabled while in flight.
  • Tab-switch + retry logging under the [rewards] prefix.
  • New unit test: fail → click Try again → refetch → success renders achievements + error banner clears.

cc @M3gA-Mind — you're the assignee on #712, happy to hand off or coordinate remaining slices. Scoped this PR to the page shell specifically so it doesn't block whatever you're doing on the individual tabs.

Problem

Rewards.tsx had no retry path: if the getMyRewards call failed at mount, the user was stuck with a yellow banner and had to reload the whole app. The error string also wasn't easy to surface for E2E or Sentry.

Solution

  • Extract loadRewards into a useCallback so it can be invoked from both the mount useEffect and a user-triggered retry.
  • Pass onRetry into RewardsCommunityTab; render a Try again pill inside the existing amber banner. Uses data-testid="rewards-error" / data-testid="rewards-retry" so the upcoming E2E slice of Stabilize Rewards page end-to-end (Referrals, Rewards, Redeem) with full test coverage #712 has stable hooks.
  • Reset error and set isLoading at the start of every fetch so retry visibly "goes back to loading" instead of lingering on the failed state.
  • Log: [rewards] fetching snapshot, [rewards] tab changed, [rewards] retry requested for ops / Sentry breadcrumbs.

Explicitly not in scope (deferred to subsequent #712 slices):

  • Referrals tab (ReferralRewardsSection) fixes.
  • Redeem tab (RewardsCouponSection) fixes.
  • Discord connect/join flow.
  • E2E specs — hooks are in place (rewards-error, rewards-retry); specs will land in the E2E slice.

Remaining #712 plan

  1. This PR — shell + retry + logging + 1 new unit test. ✅
  2. Next — Referrals tab characterization + fixes.
  3. Then — Redeem / coupons.
  4. Then — Community / Discord flow.
  5. Finally — E2E smoke + per-flow specs.

Each slice is independent and passes CI on its own; #712 stays open until the E2E slice lands.

Submission Checklist

Impact

  • Runtime: frontend only. No RPC / sidecar changes.
  • User-visible: retry button appears in the existing error banner on the Rewards tab. Everything else unchanged.
  • Migration: none.

Related

First slice of tinyhumansai#712 (Rewards stabilization). Keeps scope to the page
shell so follow-up PRs can focus on per-tab flows (referrals, redeem,
community/Discord) and E2E coverage.

- Extract loadRewards into a useCallback so retry can re-trigger it.
- Render a "Try again" button in the Community tab's error banner with
  data-testid="rewards-retry" for upcoming E2E. Disabled while the
  retry is in flight.
- Log tab transitions and retry requests under the [rewards] prefix.
- Extend Rewards.test.tsx with a retry test (fail -> click -> refetch
  -> success renders achievements, error banner disappears).

cc @M3gA-Mind (assignee on tinyhumansai#712) — happy to hand off or coordinate the
remaining slices.
@jwalin-shah jwalin-shah requested a review from a team April 22, 2026 07:35
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@jwalin-shah has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 26 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 43 minutes and 26 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1d02ca7-7d93-42bc-9b69-1c4a7f3db6ee

📥 Commits

Reviewing files that changed from the base of the PR and between 100b5b7 and bd0d227.

📒 Files selected for processing (3)
  • app/src/components/rewards/RewardsCommunityTab.tsx
  • app/src/pages/Rewards.tsx
  • app/src/pages/__tests__/Rewards.test.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@senamakel senamakel merged commit 5113b0f into tinyhumansai:main Apr 22, 2026
7 of 8 checks passed
@jwalin-shah jwalin-shah deleted the fix/rewards-shell-retry branch April 23, 2026 21:24
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
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.

3 participants