Skip to content

feat(course-page): add dynamic CTA and loading state to leaderboard rank#3535

Open
rohitpaulk wants to merge 1 commit intomainfrom
feat-course-page-dynamic-cta-loading
Open

feat(course-page): add dynamic CTA and loading state to leaderboard rank#3535
rohitpaulk wants to merge 1 commit intomainfrom
feat-course-page-dynamic-cta-loading

Conversation

@rohitpaulk
Copy link
Member

@rohitpaulk rohitpaulk commented Jan 1, 2026

Display a loading animation while fetching leaderboard rank and show a
dynamic call-to-action (CTA) message based on the user's progress and
course stage. Update modal size for better layout consistency and adjust
styles for improved spacing and alignment.

These changes enhance user engagement by providing contextual feedback
and encouragement upon completing course steps.


Note

Enhances the completion modal and leaderboard rank section with loading and contextual feedback.

  • Adds loading state isLoadingRank and animated CTA text (ctaText) driven by computeLeaderboardCTA, shown when @shouldShowCTA is true
  • Introduces new args on LanguageLeaderboardRankSection: currentCourseStage, repository, and shouldShowCTA; rank refresh now uses refreshRankTask with staged timeouts and switches template to use isLoadingRank
  • UI tweaks: modal width reduced to max-w-xs, rank section made w-full, and spacing adjustments (e.g., mb-2)

Written by Cursor Bugbot for commit efff243. This will update automatically on new commits. Configure here.

Display a loading animation while fetching leaderboard rank and show a
dynamic call-to-action (CTA) message based on the user's progress and
course stage. Update modal size for better layout consistency and adjust
styles for improved spacing and alignment.

These changes enhance user engagement by providing contextual feedback
and encouragement upon completing course steps.
@github-actions
Copy link

github-actions bot commented Jan 1, 2026

Test Results

  1 files  ±0    1 suites  ±0   7m 8s ⏱️ -1s
699 tests ±0  644 ✅ ±0  55 💤 ±0  0 ❌ ±0 
714 runs  ±0  659 ✅ ±0  55 💤 ±0  0 ❌ ±0 

Results for commit efff243. ± Comparison against base commit adf8202.

@codecov
Copy link

codecov bot commented Jan 1, 2026

Codecov Report

❌ Patch coverage is 53.33333% with 7 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...omplete-modal/language-leaderboard-rank-section.ts 53.33% 5 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!


await timeout(500);
this.ctaText = this.computedCtaText;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition between CTA check and assignment

The computedCtaText getter is called twice in refreshRankTask - once to check if it's truthy, then again 3000ms later for assignment. If the underlying leaderboard data changes during this window, the getter could return null on the second call even though the condition passed. This would assign null to ctaText (which is typed as string), causing the CTA to unexpectedly disappear. The value returned from the first check could be captured and reused instead.

Fix in Cursor Fix in Web


await timeout(500);
this.ctaText = this.computedCtaText;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading indicator stuck forever if data fetch fails

The original code used refreshRankTask.isRunning for the loading state, which automatically becomes false when the task ends regardless of success or failure. The new code uses a manual isLoadingRank tracked property that's only set to false after loadOrRefresh() succeeds. If the fetch throws an error, isLoadingRank remains true and the loading animation displays indefinitely with no way to recover.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Jan 2, 2026

Bundle Report

Changes will decrease total bundle size by 143 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
client-array-push 38.92MB -143 bytes (-0.0%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/chunk.*.js 1.5kB 403.64kB 0.37%
assets/chunk.*.js -1.56kB 3.36MB -0.05%
assets/chunk.*.js -82 bytes 40.94kB -0.2%

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