Skip to content

fix: dead link, duplicate course fetches, redirect validation, lazy dashboard tabs - #672

Merged
DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
PrimeFactor-Dev:fix/wave10-issues-516-519
Oct 24, 2026
Merged

DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
PrimeFactor-Dev:fix/wave10-issues-516-519

Conversation

@PrimeFactor-Dev

Copy link
Copy Markdown
Contributor

Closes #516, Closes #517, Closes #518, Closes #519

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional or behavioral changes)
  • Performance improvement
  • Documentation update
  • Build / CI configuration change
  • Dependency update
  • Other:

Summary

This PR fixes four navigation, networking, and security issues: a dead "View Transactions" link that 404s, duplicate catalog requests on the courses page, an unvalidated middleware redirect parameter, and dashboard hooks that fetch every tab's data on mount.

Motivation / Context

Closes #516, Closes #517, Closes #518, Closes #519.

Changes

Issue Change
#516 balance-display.tsx link now points to /rewards (label updated to "View Rewards") instead of the non-existent /transactions
#517 Added useEnrollments() and switched the courses listing to useInfiniteCourses + useEnrollments, removing the duplicate useCourses() catalog request
#518 Extended isSafeRedirectPath to reject protocol schemes (javascript:, data:, …) and control characters; added tests
#519 Added enabled options to useCourses / useRecommendedCourses / useRewards / useCredentials; dashboard gates fetches by active tab, uses per-section skeletons, and memoizes fetches across tab switches

Testing

  • Updated src/tests/wallet/balance-display.test.tsx for the /rewards link target
  • Added src/middleware.test.ts cases for javascript:, data:, vbscript:, embedded schemes, and control-character bypasses
  • Note: local npm/vitest runs were intentionally skipped in this environment; CI should validate the suite

Tradeoffs

  • Overview tab still loads summary data (enrollments, recommendations, balance, credential count) because it displays those stats. The full courses catalog now loads only when the Courses tab is selected.
  • isSafeRedirectPath rejects any redirect containing a colon-scheme pattern (e.g. /foo:bar), falling back to /dashboard. Internal routes in this app do not use colons.

Out of scope

  • Creating a dedicated /transactions page
  • Splitting rewards/credentials APIs into lighter count-only endpoints

…g /transactions

The View Transactions link targeted a route that does not exist, sending
users to a 404. Point it at /rewards, which already shows reward history.
useCourses() and useInfiniteCourses() each requested the catalog on mount.
Add useEnrollments() for enrollment badges so the listing only uses
useInfiniteCourses for course data.
…t param

Extend isSafeRedirectPath to reject javascript:/data:/vbscript: style
schemes and control characters used in open-redirect bypasses, and cover
the acceptance criteria with tests.
Add an enabled option to useCourses, useRecommendedCourses, useRewards
and useCredentials. The dashboard now gates each section by the active
tab, replaces the global loading gate with per-section skeletons, and
memoizes fetches so switching tabs does not re-request data.
@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for chainlearn failed.

Name Link
🔨 Latest commit 6d39201
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6adbc9630f24a769ca067818

@DeFiVC
DeFiVC merged commit 62d7b7a into ChainLearnOfficial:main Oct 24, 2026
1 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants