Bug Report: search_limit URL Parameter Always Defaults to 1 Regardless of Input
Summary
The search_limit query parameter in the /new route is not respecting user-provided values. Despite accepting values between 1-5, it always defaults to 1 due to a type-checking issue in the normalizeSearchLimit function.
Description
When constructing a URL with search_limit set to any integer (e.g., search_limit=3 or search_limit=5), the application ignores the provided value and defaults to 1. This occurs because URL parameters are passed as strings, but the validation logic uses Number.isFinite() which returns false for string representations of numbers.
Steps to Reproduce
Navigate to the following URL:
https://t3.chat/new?model=gemini-3-flash&q=test+query&search=true&search_limit=5Observe that the search is performed with a limit of 1 result instead of the requested 5.
Verify in browser DevTools that the parameter is correctly present in the URL, but the application state shows
searchLimit: 1.
Root Cause Analysis
In the route loader for /new (file: assets/main-BjZGlmNP.js), the search_limit parameter is processed as follows:
const wY = Qw.search_limit !== void 0
? normalizeSearchLimit(Qw.search_limit)
: bY?.searchLimit;
The normalizeSearchLimit function contains the following logic:
function normalizeSearchLimit(Qw) {
if (Qw === void 0) return void 0;
if (!Number.isFinite(Qw)) return 1; // <-- Bug here
const vY = Math.floor(Qw);
return Math.min(5, Math.max(1, vY))
}
The Issue: URL query parameters are always strings. When search_limit=5 is provided, Qw receives the string "5", not the number 5.
Number.isFinite("5") returns false because it strictly checks for finite numbers, not numeric strings. This causes the function to immediately return 1 instead of parsing the value.
Verification:
Number.isFinite("5") // false (string)
Number.isFinite(5) // true (number)
Number.isFinite("5") === Number.isFinite("invalid") // both false
Impact
Users cannot customize the number of search results via URL sharing or bookmarks
The
search_limitparameter in the URL schema is effectively non-functionalForces users to manually adjust search limits in the UI for every session
Suggested Fix
Convert the parameter to a number before type checking, or use a more permissive validation:
function normalizeSearchLimit(Qw) {
if (Qw === void 0) return void 0;
const num = Number(Qw); // Convert string to number
if (!Number.isFinite(num)) return 1;
const vY = Math.floor(num);
return Math.min(5, Math.max(1, vY))
}
Alternatively, ensure the schema validation (Int.pipe(optional$2)) properly coerces the string to an integer before it reaches the normalization function.
Environment
Browser: Zen Browser (Firefox-based), Chrome, Safari (all affected)
OS: Cross-platform
App Version: Current production build as of 2026-02-03
Route:
/newAffected Code: Route loader in
main-BjZGlmNP.js(validateSearch schema and loader function)
Log in to comment and vote
No comments yet
Be the first to share your thoughts.