fix: eliminate useSearchParams self-redirect loop on listing detail pages - #176
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Extract useSearchParams() out of useAuctionDetail hook and into a
dedicated ReferralReader component wrapped in its own <Suspense>
boundary.
In Next.js 16, calling useSearchParams() inside a client component
that is rendered within a <Suspense> boundary triggers a 307 self-
redirect loop during SSR, causing listing pages to render blank.
Changes:
- useAuctionDetail.ts: remove useSearchParams() call; accept
referralAddress as an optional prop instead
- listing/[listingId]/AuctionDetailClient.tsx: remove top-level
useSearchParams() call; add ReferralReader component that reads
search params inside its own <Suspense fallback={null}> boundary;
pass referralAddress state to useAuctionDetail
Fixes #175
Copilot
AI
changed the title
[WIP] Fix blank listing detail pages due to self-redirect loop in Next.js 16
fix: eliminate useSearchParams self-redirect loop on listing detail pages
Jun 26, 2026
mxjxn
marked this pull request as ready for review
June 26, 2026 14:41
mxjxn
approved these changes
Jun 26, 2026
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.
In Next.js 16, calling
useSearchParams()inside a client component rendered within a<Suspense>boundary causes the RSC renderer to emit a307 replaceredirect to the same URL — an infinite loop that Next.js breaks by serving its 404 page. All/listing/[listingId]pages were blank as a result.Changes
useAuctionDetail.ts: RemoveduseSearchParams()call. Hook now acceptsreferralAddress?: string | nullas a prop instead of reading it from search params internally.listing/[listingId]/AuctionDetailClient.tsx:useSearchParams()(thechainIdread was redundant — the server component already handleschainIdredirects before the client renders)ReferralReaderleaf component wrapped in its own<Suspense fallback={null}>, isolating the bailout boundary from the rest of the pagereferralAddressstate (viauseCallback-memoized setter) down touseAuctionDetail