Skip to content

fix: recommendations refresh endpoint always returns 400, silent error swallowing#447

Open
Xenon010101 wants to merge 1 commit into
ItsVikasA:mainfrom
Xenon010101:fix-recommendation-engine
Open

fix: recommendations refresh endpoint always returns 400, silent error swallowing#447
Xenon010101 wants to merge 1 commit into
ItsVikasA:mainfrom
Xenon010101:fix-recommendation-engine

Conversation

@Xenon010101

Copy link
Copy Markdown

Fixes #441

Bugs Fixed

1. Refresh button always failed (400)

The frontend sent courseId: null + feedbackType: "refresh" but the backend required a non-null courseId, returning 400 for every refresh attempt.

Fix: Added refresh handling in POST /api/recommendations that invalidates the cache and returns success without requiring courseId.

2. Silent error swallowing on refresh failure

The frontend handleFeedback had no else clause on response.ok, so HTTP errors were silently ignored. Users would click refresh, see no feedback, and the recommendations would not update.

Fix: Added else block that parses the error response and shows a toast with the actual error message.

Testing

  • Refresh button now invalidates cache and regenerates recommendations
  • HTTP errors show a toast with the error message instead of failing silently

Fixes ItsVikasA#441

Backend:
- Added 'refresh' feedbackType handler in POST /api/recommendations
  that invalidates cache and returns success without requiring courseId

Frontend:
- Added else clause in handleFeedback to show error toast when
  response.ok is false, preventing silent failures
@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

@Xenon010101 is attempting to deploy a commit to the Vikas' projects Team on Vercel.

A member of the Team first needs to authorize it.

@Xenon010101

Copy link
Copy Markdown
Author

Hi maintainer! This PR has been open for a while — just a friendly nudge for review when you get a chance. Thanks!

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.

Recommendation engine does not generate recommendations for new users and some existing users.

1 participant