fix SSR of program marketplace pages#4042
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR migrates the external marketplace from an ChangesMarketplace Route Migration and SSR Optimization
Sequence Diagram(s)sequenceDiagram
participant Browser
participant Middleware as Next.js Middleware
participant ListPage as MarketplaceExternalListPage (Server)
participant Cache as unstable_cache
participant DB as Program Fetchers
participant Client as MarketplaceExternalListPageClient (SWR)
Browser->>Middleware: GET /marketplace/all?search=foo
Middleware-->>Browser: NextResponse.next()
Browser->>ListPage: render
ListPage->>Cache: parsePublicMarketplaceQuery(searchParams) → key
Cache->>DB: fetch programs + totalCount + filterCounts
DB-->>Cache: results
Cache-->>ListPage: { programs, totalCount, filterCounts }
ListPage->>Client: initialData + params
Client->>Client: shouldUseInitialData check
Client-->>Browser: render with SSR fallbackData (no loading flash)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2d550c7 to
b543c82
Compare
|
@coderabbitai full review, any regressions, bugs, performance issues? |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Fetch PR details
gh pr view 4042 --repo dubinc/dub --json title,body,files,additions,deletions,state,headRefName
echo "---FILES CHANGED---"
gh pr diff 4042 --repo dubinc/dubLength of output: 31502 🏁 Script executed: #!/bin/bash
echo "=== middleware.ts - check if fullPath is still referenced ==="
cat apps/web/middleware.ts
echo ""
echo "=== MarketplaceExternalShell title prop ==="
cat apps/web/ui/program-marketplace/external/marketplace-external-shell.tsx 2>/dev/null || echo "NOT FOUND"
echo ""
echo "=== slugToCategory in urls.ts ==="
fd -e ts "urls.ts" apps/web/ui/program-marketplace --exec cat {}
echo ""
echo "=== getPublicNetworkProgramFilterCounts signature ==="
fd -e ts "get-public-network-program-filter-counts.ts" apps/web/lib --exec cat {}
echo ""
echo "=== getPublicNetworkPrograms / count signatures ==="
fd -e ts "get-public-network-programs.ts" apps/web/lib --exec cat {}
echo ""
echo "=== parsePublicMarketplaceQuery full ==="
cat apps/web/lib/marketplace/parse-public-marketplace-query.ts
echo ""
echo "=== MarketplaceExternalProgramPage - does it still exist? ==="
fd -e tsx "marketplace-external-program-page.tsx" apps/web --exec cat {}
echo ""
echo "=== MarketplaceExternalHomePage ==="
fd -e tsx "marketplace-external-home-page.tsx" apps/web --exec cat {}
echo ""
echo "=== getMarketplaceProgramHref / getMarketplaceCanonicalUrl ==="
fd -e ts "urls.ts" apps/web/ui/program-marketplace --exec grep -n "getMarketplaceProgramHref\|getMarketplaceCanonicalUrl\|slugToCategory\|getMarketplacePathFromSlug" {}
echo ""
echo "=== app.ts middleware - full file ==="
cat apps/web/lib/middleware/app.ts
echo ""
echo "=== Check if fullPath is used elsewhere in middleware.ts ==="
grep -n "fullPath" apps/web/middleware.ts
echo ""
echo "=== generateMarketplaceProgramStaticParams ==="
fd -e tsx -e ts "marketplace-program-page.tsx" apps/web --exec cat {}
echo ""
echo "=== ProgramCategory variant prop ==="
fd -e tsx "program-category.tsx" apps/web --exec cat {}
echo ""
echo "=== MarketplaceExternalFilterSidebar - does it handle empty arrays? ==="
fd -e tsx "marketplace-external-filter-sidebar.tsx" apps/web --exec cat {}
echo ""
echo "=== Check reexports/imports of MarketplaceExternalRouter - any remaining refs? ==="
rg -rn "marketplace-external-router\|MarketplaceExternalRouter" apps/web/Length of output: 37048
Overall AssessmentThe restructuring is well-designed. Moving from a single No critical bugs found. A few items worth reviewing: 🔴 Potential Issue — Visual Regression: Category Page
|
| Item | Status |
|---|---|
fullPath removed from middleware.ts destructuring |
Not used elsewhere — clean ✅ |
Next.js route precedence (all/, c/[slug] before [programSlug]) |
Static routes take priority over dynamic segments ✅ |
generateStaticParams mapping { slug: [program.slug] } → { programSlug: slug[0] } |
Correct ✅ |
slugToCategory excluding reserved slugs ("all", "popular", "c") |
Correctly returns null for reserved slugs ✅ |
/marketplace/popular fallback path |
App middleware redirects first; if leaked, MarketplaceExternalProgramPage redirects to home ✅ |
shouldUseInitialData param comparison |
Both server and client use parsePublicMarketplaceQuery; defaults are consistent ✅ |
No remaining references to deleted MarketplaceExternalRouter |
Confirmed clean removal ✅ |
DubAnalytics cookieOptions.domain |
VERCEL === "1" is set on all Vercel deployments ✅ |
MarketplaceExternalProgramPage still exists and is properly wired |
✅ |
ProgramCategory variant="default" without onClick/href |
Renders <div> — valid inside <Link> ✅ |
Summary
No regressions that would break core functionality. The two items most worth double-checking before merge are:
- The category page
<h1>line break — quick visual check on a category URL - The
+Ncategories tooltip — acceptable for now if the team is OK with mobile users not seeing hidden category names
✅ Action performed
Full review finished.
|
@coderabbitai The category page |
|
Tip For best results, initiate chat on the files or code changes.
✏️ Learnings added
|
|
Tip For best results, initiate chat on the files or code changes.
✏️ Learnings added
|
| addedToMarketplaceAt: { | ||
| not: null, | ||
| }, | ||
| groups: { |
There was a problem hiding this comment.
unifying detail page and sitemap public marketplace eligibility with the following locations:
get-public-network-programs.tsget-public-network-program-filter-counts.tsapi/network/programs/count/route.ts
Summary by CodeRabbit
Release Notes
New Features
Performance Improvements
UI Updates