From 190a34f372a84b7347e011191c544edc1000d916 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Mon, 11 Nov 2024 11:07:28 +0100 Subject: [PATCH] doc: Wording --- errors/NUQS-414.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/errors/NUQS-414.md b/errors/NUQS-414.md index 91c6b51d..4b498a90 100644 --- a/errors/NUQS-414.md +++ b/errors/NUQS-414.md @@ -1,12 +1,28 @@ # Max Safe URL Length Exceeded -This error occurs if your URI length exceeds 2,000 -characters, there are varying browser limitations -for max URL lengths. +This error occurs if your URL length exceeds 2,000 characters. -See [here](https://nuqs.47ng.com/docs/limits#max-url-lengths) for URL max lengths across different browsers. +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 -Refactor your state architecture to ensure your total -URL length doesn't exceed 2,000 characters. +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.