refactor(freelancer-reviews): remove mock data and related functions …#297
Open
DanielCotoJ wants to merge 1 commit into
Open
refactor(freelancer-reviews): remove mock data and related functions …#297DanielCotoJ wants to merge 1 commit into
DanielCotoJ wants to merge 1 commit into
Conversation
…for freelancer reviews
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Pull Request
🔧 Title:
lib/api/freelancer-public.ts🛠️ Issue
📚 Description
src/lib/api/freelancer-public.tscontained hardcoded fake data: fabricated reviewers(Jordan Lee, Sam Rivera, Casey Kim) with static ratings/dates in
MOCK_REVIEWS_BASE, anda fake profile summary ("Alex Morgan", 4.7 rating) in
MOCK_SUMMARY. This scaffolding wasgated behind the
NEXT_PUBLIC_USE_MOCK_FREELANCER_PUBLICenv flag and risked surfacingfabricated reviews/profiles on public freelancer pages, which is misleading and breaks
trust.
All mock scaffolding has been removed so both public functions
(
getPublicFreelancerSummaryandgetPublicFreelancerReviews) call the real backendendpoints only:
GET /marketplace/freelancers/:idGET /marketplace/freelancers/:id/reviewsError handling was already throw-based and is left unchanged:
getPublicFreelancerReviewspropagates API errors (the consumer page catches them and renders an error state), and a
404 returns an empty result that renders the existing "No reviews yet" empty state. No new
error pattern was introduced and no consumer changes were needed.
✅ Changes applied
MOCK_REVIEWS_BASE(fake reviewers/ratings/dates) and all references to it.USE_MOCKflag,MOCK_SUMMARY,MOCK_DIST,buildMockStats(),mockSummaryForId(),mockReviewsResult().if (USE_MOCK)early-return branches ingetPublicFreelancerSummaryand
getPublicFreelancerReviews.unwrapData()and all real fetch/normalization logic (existing repo convention).src/app/marketplace/freelancers/[id]/reviews/page.tsx)already renders an empty state ("No reviews yet") and an error state.
Out of scope / not testable until backend is live
GET /marketplace/freelancers/:id/reviewsserves live data. Until then the page showsthe empty or error state, which is the intended behavior.
unrelated accessibility task).
🔍 Evidence/Media (screenshots/videos)
The command searched the src/ folder for the old mock freelancer review identifiers. It returned no matches, which means those mock references are no longer present in the source code. The exit code 1 is expected for grep when nothing is found.