Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Add limits page to docs #739

Merged
merged 7 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/docs/content/docs/limits.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Limits
description: There are some limits you should be aware of when using nuqs or URL params in general.
---

## URL update throttling

Browsers rate-limit the History API, updates to the URL are queued and throttled to a default of 50ms, which seems to satisfy most browsers even when sending high-frequency query updates, like binding to a text input or a slider.

Safari’s rate limits are much higher and require a throttle of 120ms (320ms for older versions of Safari).

Nuqs handles this out of the box so you don't run into those rate-limits, however it is possible to set your own custom throttles.

For more info how to set custom throttles see [Throttling URL updates](./options#throttling-url-updates).

## Max URL lengths

Most modern browsers enforce a max URL length, which can vary:

- **Chrome:** ~2 MB (practically, you might encounter issues at around 2,000 characters).
- **Firefox:** ~65,000 characters.
- **Safari:** Generally has more restrictive limits (around 80,000 characters).
- **IE/Edge:** Historically limited to 2,083 characters (IE), although Edge has relaxed this limit.

Additionally, transport mechanisms like social media, messaging apps, and emails may impose significantly lower limits on URL length. Long URLs may be truncated, wrapped, or rendered unusable when shared on these platforms.

Keep in mind that not all application state should be stored in URLs. Exceeding the 2,000-character range may indicate the need to reconsider your state management approach.
franky47 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions packages/docs/content/docs/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"options",
"batching",
"server-side",
"limits",
"---Going further---",
"utilities",
"debugging",
Expand Down