deen
deen3w ago

URLSearchParams size property is unsupported in Convex

const params1 = new URLSearchParams('foo=bar&baz=qux')
console.log(params1.size) // expected: 2, convex: undefined

const params2 = new URLSearchParams({ a: '1', b: '2', c: '3' })
console.log(params2.size) // expected: 3, convex: undefined
const params1 = new URLSearchParams('foo=bar&baz=qux')
console.log(params1.size) // expected: 2, convex: undefined

const params2 = new URLSearchParams({ a: '1', b: '2', c: '3' })
console.log(params2.size) // expected: 3, convex: undefined
Very much not a big deal because there's many other ways to do this, but I was writing a little query builder and for some reason used it (shamefully) like this if (searchParams.size) ..., which had me tricked for a while. Added in node v18.16.0: https://nodejs.org/api/url.html#urlsearchparamssize https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/size
MDN Web Docs
URLSearchParams: size property - Web APIs | MDN
The size read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
1 Reply
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!

Did you find this page helpful?