mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #79] [MERGED] fix(navigation): cache getServerSnapshot fallback in useSearchParams #292
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#292
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/79
Author: @gembleman
Created: 2/25/2026
Status: ✅ Merged
Merged: 2/27/2026
Merged by: @FredKSchott
Base:
main← Head:fix/use-search-params-server-snapshot-cache📝 Commits (2)
cf7d576fix(navigation): cache getServerSnapshot fallback in useSearchParamsea4b896Refactor cached search params and pathname logic📊 Changes
1 file changed (+20 additions, -12 deletions)
View changed files
📝
packages/vinext/src/shims/navigation.ts(+20 -12)📄 Description
useSyncExternalStore compares snapshots with Object.is. The previous getServerSnapshot returned
new URLSearchParams()on every call when no server context was available, producing a new object reference each time and triggering an infinite re-render loop in React.Fix: introduce a module-level
_cachedServerSearchParamsthat is allocated once and reused, matching the same referential-stability pattern already used bygetSearchParamsSnapshotfor the client snapshot.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.