Skip to content

fix: remove duplicate imports and dead code (#520 #521 #522 #523) - #673

Merged
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
taofeeq991:fix/issues-520-521-522-dead-code-cleanup
Oct 26, 2026
Merged

DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
taofeeq991:fix/issues-520-521-522-dead-code-cleanup

Conversation

@taofeeq991

@taofeeq991 taofeeq991 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes duplicate imports, dead code, and a broken render path across three files. Addresses #520, #521, #522, #523, plus a related types-file issue that was blocking compilation.

Changes

#520 — src/lib/api/credentials.ts

  • Removed a duplicate getValidToken import that was misplaced mid-file (after the VerifyCredentialResult interface). The correct top-of-file import is retained and still used by getCredentials and mintCredential.
  • Note: the original report referenced duplicate CredentialNFT and unused CredentialMetadata; the current file had neither. CredentialNFT was single and used; CredentialMetadata was not imported. The real duplicate was getValidToken.

#521 — package.json

  • No change required. @radix-ui/react-avatar and @radix-ui/react-dialog each appeared exactly once in the current file. The duplicates described in the report were not present.

#523 — vitest config files

  • No change required. Only vitest.config.ts exists; vitest.config.mts was already removed in commit fbbabf2 ("refactor: consolidate duplicate vitest configs and test directories"). The single-config acceptance criterion is already met.

#522 — src/app/courses/[courseId]/modules/[moduleId]/page.tsx

  • Removed three redundant type-guard render blocks (isTextContent, isVideoContent, isInteractiveContent on raw module.content) and their import.
  • Kept the single parseModuleContent(module) call (stored once in content) and the discriminated-union ternary (content.type === "video" / "interactive", text as fallback).
  • No as any casts existed; none were introduced.
  • The real issue was two competing render approaches from an incomplete refactor merging into structurally broken JSX. Removing the old blocks leaves a single clean ternary.

Types file — src/types/course.ts

  • Removed the duplicate ModuleContent type definition (two conflicting shapes existed in the same file).
  • Removed the duplicate content property on the Module interface (now a single content: string | ModuleContent).
  • Removed the now-unused type guards (isTextContent, isVideoContent, isInteractiveContent) and the dead parseModuleContent(content: ModuleContent): string helper. Grep confirms zero dangling references across the codebase.

What was tested

  • Verified each file by reading it back after edits.
  • Confirmed via grep that no dangling references to removed symbols remain anywhere in the codebase.
  • Confirmed ModuleContent now appears exactly once with the correct shape, and parseModuleContent in src/lib/api/courses.ts returns the structured union used by the page and the test suite.

Not verified

  • tsc --noEmit, ESLint, and the test suite (vitest) could not be run because node_modules was not installed in the working environment. Recommend running npm install && npm run typecheck && npm run lint && npm test in CI.

Closes #520, Closes #521, Closes #522, Closes #523

…ainLearnOfficial#520, ChainLearnOfficial#521, ChainLearnOfficial#522)

- credentials.ts: remove duplicate getValidToken import (ChainLearnOfficial#520)
- module page: remove redundant type-guard render blocks, keep single
  parseModuleContent call with discriminated-union narrowing (ChainLearnOfficial#522)
- types/course.ts: remove duplicate ModuleContent definition, duplicate
  Module.content property, and now-unused type guards / parseModuleContent
- package.json: ChainLearnOfficial#521 no change needed (duplicates not present)
@netlify

netlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for chainlearn failed.

Name Link
🔨 Latest commit 99ab710
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6addff979c7599278856e047

@taofeeq991 taofeeq991 changed the title fix: remove duplicate imports and dead code (#520 #521 #522) fix: remove duplicate imports and dead code (#520 #521 #522 #523) Oct 25, 2026
@DeFiVC
DeFiVC merged commit d6a50bb into ChainLearnOfficial:main Oct 26, 2026
0 of 4 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