fix: bulk load complete card data across collections - #127
Conversation
Strix Security ReviewWarning This pull request has 19 commits after the last Strix review ( No security issues found. Updated for Reviewed by Strix |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughSaved, liked, and recommendation views now bulk-fetch like counts and ratings, include creator verification data, and pass enriched fields to ChangesPrompt enrichment
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Empty views avoid database enrichment through the existing helper guards. No actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
aashu2006
left a comment
There was a problem hiding this comment.
thanks for the detail in the writeup. I re-checked this against current main.
The per-prompt request part of #86 already landed in d460d49 on main, which is why this conflicts. Saved, Liked and the related cards on PromptDetail all use bulk lookups now.
What your PR fixes that main still gets wrong:
likeCountis hardcoded to0on all three, andPromptCarddoes not fetch it, so every card there shows 0 likes.- None of the three pass
accuracyRatingorratingCount, so the rating stars never show. - The Saved page builds its creator object without
verified, so the badge is missing there.
Those are worth keeping. To get this mergeable:
- Wait for #126 to merge, then rebase on main. #126 touches
PromptDetail.tsxandusePrompts.tstoo. - After the rebase the diff should be much smaller. Main already does the bulk lookups, so what is left is adding
getLikeCountsandgetPromptRatingsto the three pages and addingverifiedto the Saved creator object. - If you keep a shared helper, please move it out of
src/hooks/since it is not a hook, and import the services statically at the top like the pages do now. The five sequentialawait import(...)calls put five module loads in front of every list.
Please also update the description, since the request-per-card claim no longer matches main.
f36f6e9 to
96f7fc9
Compare
|
Rebased on current main after #126 merged and force-pushed commit |
aashu2006
left a comment
There was a problem hiding this comment.
Thanks @sridharkalaibala ⭐️, this is exactly the right scope. Real like counts, ratings and the verified badge on Saved, all through bulk lookups, with the existing structure kept. Approving.
What does this change?
Fixes #86. Saved, Liked, and related-prompt cards now load real like counts and aggregate ratings through one bulk request per data type. Saved cards also receive the creator's verified status, and all three views pass the rating values into
PromptCard.Why?
Current main already bulk-loads creators and viewer relationships, but these three views still hardcode
likeCountto zero and omitaccuracyRatingandratingCount. Saved also dropscreator.verified. The same prompt can therefore show incomplete information outside the main gallery.This revision is rebased on #126 and keeps the existing page-level bulk-loading structure. It adds only the missing count/rating lookups and Saved verification data.
How was it tested?
npm test: 160 tests across 28 files passnpm run lint: passes with 25 existing warningsnpm run typecheck: passesnpm run build: passesgit diff origin/main --check: passesChecklist
npm run lintpassesnpm run typecheckpassesnpm testpassesnpm run buildpasses.envfiles are includedPrepared and validated with OpenAI Codex assistance.