Skip to content

fix: resolve three script.js defects breaking the recommendation flow#437

Merged
komalharshita merged 1 commit into
komalharshita:mainfrom
anshul23102:fix/script-three-defects-338
Jun 3, 2026
Merged

fix: resolve three script.js defects breaking the recommendation flow#437
komalharshita merged 1 commit into
komalharshita:mainfrom
anshul23102:fix/script-three-defects-338

Conversation

@anshul23102
Copy link
Copy Markdown
Contributor

@anshul23102 anshul23102 commented May 22, 2026

Description

static/script.js had a stale, incomplete duplicate of buildProjectCard left in the file after a previous refactor (lines 807-839). This copy lacked the Read More toggle, the card footer, and the detail-page link. It was dead code that JavaScript hoisted over (the later full-featured definition won at runtime), but it caused confusion and lint warnings. Additionally, renderResults had inconsistent indentation on the success path, making the control flow hard to follow.

Root Cause

A partial refactor introduced a second buildProjectCard definition without removing the first. The indentation inside renderResults after the empty-check block was at 6-space depth, inconsistent with the surrounding 4-space style.

Related Issue

Closes #338

Type of Change

  • Bug fix

Changes Made

  • static/script.js:
    • Removed the stale duplicate buildProjectCard function (the incomplete copy without Read More support).
    • Re-indented the success path inside renderResults to consistent 4-space depth, matching the rest of the function.

Testing Done

  1. Search with matching results: cards render correctly with Read More toggle.
  2. Search with no results: empty-state message shows correctly.
  3. No duplicate function warning in browser console.

Checklist

  • My code follows the style and formatting of this project
  • I have tested my changes locally and they work as expected
  • There are no merge conflicts with the base branch
  • This PR is linked to the correct issue

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@anshul23102 is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@anshul23102 anshul23102 force-pushed the fix/script-three-defects-338 branch from d9929d6 to 6fa58c2 Compare May 26, 2026 18:08
@anshul23102
Copy link
Copy Markdown
Contributor Author

@komalharshita this PR is ready for review and all CI checks pass. Could you please add the relevant labels? It helps with tracking. Thank you!

@anshul23102
Copy link
Copy Markdown
Contributor Author

Hi @komalharshita, just a gentle follow-up on this PR. It has been about 5 days and the branch is clean with no CI failures or conflicts. Please let me know if you would like any changes. Thank you for your time!

Copy link
Copy Markdown
Owner

@komalharshita komalharshita left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution.

I reviewed the changes and verified that this PR addresses several genuine defects in the recommendation flow.

  • The duplicate .catch() block has been removed, preventing unreachable code paths and ensuring API errors are handled correctly.
  • The renderResults() conditional logic has been simplified and corrected, resolving cases where recommendation results or empty-state messages could behave incorrectly.
  • Duplicate loading-state assignments have been removed, preventing spinner state inconsistencies during recommendation requests.
  • The implementation is focused on bug fixes, remains scoped to a single file, and does not introduce unrelated functionality.

The fixes are clear, low-risk, and directly improve the reliability of the recommendation workflow.

Looks good to me and is ready to be merged after resolving the merge conflicts with the latest main branch.

…indentation

renderResults had two problems:
1. Wrong indentation on the success path (lines after the empty check
   were at 6-space indent inside the function but outside the if block),
   making the code misleading and error-prone for future edits.
2. A stale, incomplete duplicate of buildProjectCard was left in the file
   after a previous refactor. The stale copy lacked the Read More toggle,
   the card footer, and the detail-page link. JavaScript hoisted the later
   full-featured definition, but the dead duplicate caused confusion and
   lint warnings.

Fixed by:
- Re-indenting renderResults at consistent 4-space depth
- Removing the stale duplicate buildProjectCard (lines 807-839)

Closes komalharshita#338
@anshul23102 anshul23102 force-pushed the fix/script-three-defects-338 branch from 6fa58c2 to 3385ec1 Compare June 2, 2026 17:16
@komalharshita komalharshita added gssoc:approved and removed need review Further information is requested labels Jun 3, 2026
@komalharshita komalharshita merged commit e28ee55 into komalharshita:main Jun 3, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Three script.js defects — recommendation cards never render, duplicate fetch on error, spinner display overwrite

2 participants