Skip to content

fix: bulk load complete card data across collections - #127

Merged
aashu2006 merged 1 commit into
paro-studio:mainfrom
sridharkalaibala:fix/bulk-card-enrichment
Sep 22, 2026
Merged

aashu2006 merged 1 commit into
paro-studio:mainfrom
sridharkalaibala:fix/bulk-card-enrichment

Conversation

@sridharkalaibala

@sridharkalaibala sridharkalaibala commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

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 likeCount to zero and omit accuracyRating and ratingCount. Saved also drops creator.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?

  • Focused page test covers Saved, Liked, and recommendations and verifies complete card props plus one bulk call per required data type.
  • npm test: 160 tests across 28 files pass
  • npm run lint: passes with 25 existing warnings
  • npm run typecheck: passes
  • npm run build: passes
  • git diff origin/main --check: passes
  • Hosted CI passes all seven jobs: lint, typecheck, test, build, schema check, migration application, and actionlint. The local Windows schema check reports the unchanged generated schema as out of date; this PR contains no schema or migration changes.

Checklist

  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • No credentials, keys, or .env files are included
  • I've read and agree to the CLA in CONTRIBUTING.md

Prepared and validated with OpenAI Codex assistance.

@strix-security

strix-security Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Strix Security Review

Warning

This pull request has 19 commits after the last Strix review (f36f6e9). Strix has not reviewed these changes.
Automatic review on push is off for this repository. To review the latest changes, tag @strix-security in a comment, or turn on re-review on push.

No security issues found.

Updated for f36f6e9.


Reviewed by Strix
Re-run review · Configure security review settings

@aashu2006

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2cec030e-a170-4b41-8514-ed8b2a257b37

📥 Commits

Reviewing files that changed from the base of the PR and between f36f6e9 and 96f7fc9.

📒 Files selected for processing (4)
  • src/pages/CardEnrichment.test.tsx
  • src/pages/Liked.tsx
  • src/pages/PromptDetail.tsx
  • src/pages/Saved.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Saved, liked, and recommendation views now bulk-fetch like counts and ratings, include creator verification data, and pass enriched fields to PromptCard. Integration tests cover the three views and verify bulk lookup behavior.

Changes

Prompt enrichment

Layer / File(s) Summary
Saved and liked card enrichment
src/pages/Saved.tsx, src/pages/Liked.tsx
Saved and liked prompts now use bulk engagement and rating lookups. Cards receive fetched like counts, ratings, rating counts, and creator verification data.
Recommendation card enrichment
src/pages/PromptDetail.tsx
Recommendations now use fetched like counts and rating data instead of zero-value defaults.
Cross-view enrichment validation
src/pages/CardEnrichment.test.tsx
Integration tests verify enriched card data, expected counts, bulk lookup usage, view-specific lookups, and the absence of individual profile queries.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: rahulkr182

Merge Risk: ⚪ Minimal · up to 96f7f

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #86 requires database like counts, ratings and rating counts, creator verification, bulk enrichment, consistent card props, and fixed request counts. The PR updates Saved, Liked, and recommendat…
Out of Scope Changes check ✅ Passed The reported changes are limited to enrichment in Saved, Liked, and recommendation views and tests for the behavior required by issue #86. The tests directly verify the issue requirements. No unrelate…
Description check ✅ Passed The description includes the required What, Why, How was it tested, and Checklist sections. It clearly explains the bulk enrichment changes and lists detailed validation results. Two checklist items a…
Title check ✅ Passed The title clearly and concisely describes the main change: bulk loading complete card data across collection views.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@aashu2006 aashu2006 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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:

  • likeCount is hardcoded to 0 on all three, and PromptCard does not fetch it, so every card there shows 0 likes.
  • None of the three pass accuracyRating or ratingCount, 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:

  1. Wait for #126 to merge, then rebase on main. #126 touches PromptDetail.tsx and usePrompts.ts too.
  2. After the rebase the diff should be much smaller. Main already does the bulk lookups, so what is left is adding getLikeCounts and getPromptRatings to the three pages and adding verified to the Saved creator object.
  3. 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 sequential await 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.

@sridharkalaibala

sridharkalaibala commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased on current main after #126 merged and force-pushed commit 96f7fc9. I removed the shared helper and kept the current page-level static imports. The remaining diff adds the missing bulk like-count/rating lookups to Saved, Liked, and recommendations, adds Saved creator verification, and passes rating props into each PromptCard. Local validation: 160 tests pass, lint passes with 25 existing warnings, typecheck passes, build passes, and the diff whitespace check passes. I also updated the PR description to match current main. Hosted CI now passes all seven jobs, including schema and migrations.

@aashu2006 aashu2006 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

#129 and #130 can be rebased on main now too.

@aashu2006
aashu2006 added this pull request to the merge queue Sep 22, 2026
Merged via the queue into paro-studio:main with commit 39b45f0 Sep 22, 2026
9 checks passed
@sridharkalaibala

Copy link
Copy Markdown
Contributor Author

Thank you for the approval and merge. I have rebased both existing follow-ups #129 and #130 on current main as requested.

This branch was successfully deployed

1 active deployment
Preview — 96f7fc97 Deployed Sep 22, 2026 by vercel[bot]
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.

bug: saved, liked and recommendations show wrong data and fire a request per prompt

2 participants