generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Log an error in development if URI size of 2000 characters is ex…
…ceeded. (#747) * feat: add limits tab to docs * feat: add error logging if maximum uri size is exceeded * fix: linting * Update errors/NUQS-414.md Co-authored-by: François Best <[email protected]> * Update packages/nuqs/src/errors.ts Co-authored-by: François Best <[email protected]> * Update packages/nuqs/src/update-queue.ts Co-authored-by: François Best <[email protected]> * fix: update solution text * fix: add link to max url lengths * fix: move warning function call and refactor some code * fix: linting * fix: rename constant * doc: Wording * ref: Move warning to url-encoding, add tests --------- Co-authored-by: niklasbec <[email protected]> Co-authored-by: François Best <[email protected]>
- Loading branch information
1 parent
6bc229a
commit 3017660
Showing
5 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Max Safe URL Length Exceeded | ||
|
||
This error occurs if your URL length exceeds 2,000 characters. | ||
|
||
There are varying browser limitations for max URL lengths, [read more](https://nuqs.47ng.com/docs/limits#max-url-lengths). | ||
|
||
URLs that are too long might break in some browsers, or not be able to be | ||
processed by some servers. | ||
|
||
## Possible Solutions | ||
|
||
Keeping your URLs short is a good practice: not all state has to live in the URL. | ||
|
||
- Server state/data is best managed in a local cache like TanStack Query or SWR. | ||
- Transient state (that doesn't need persisting or sharing) can be managed in local state. | ||
- Device-persistent state can be managed in local storage. | ||
|
||
When deciding to put state in the URL, ask yourself: | ||
|
||
- Do I need it to persist across page refresh? | ||
- Do I need to share it with others? | ||
- Do I need to link to it from other places? | ||
- Do I need to be able to bookmark it? | ||
- Do I need to be able to use the Back/Forward buttons to navigate to it? | ||
- Is it always going to be a small amount of data? | ||
|
||
If the answer to any of these questions is no, then you might want to consider | ||
an alternative state storage solution. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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