Skip to content

Commit 190a34f

Browse files
committedNov 12, 2024
doc: Wording
1 parent d420e5c commit 190a34f

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed
 

Diff for: ‎errors/NUQS-414.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
# Max Safe URL Length Exceeded
22

3-
This error occurs if your URI length exceeds 2,000
4-
characters, there are varying browser limitations
5-
for max URL lengths.
3+
This error occurs if your URL length exceeds 2,000 characters.
64

7-
See [here](https://nuqs.47ng.com/docs/limits#max-url-lengths) for URL max lengths across different browsers.
5+
There are varying browser limitations for max URL lengths, [read more](https://nuqs.47ng.com/docs/limits#max-url-lengths).
6+
7+
URLs that are too long might break in some browsers, or not be able to be
8+
processed by some servers.
89

910
## Possible Solutions
1011

11-
Refactor your state architecture to ensure your total
12-
URL length doesn't exceed 2,000 characters.
12+
Keeping your URLs short is a good practice: not all state has to live in the URL.
13+
14+
- Server state/data is best managed in a local cache like TanStack Query or SWR.
15+
- Transient state (that doesn't need persisting or sharing) can be managed in local state.
16+
- Device-persistent state can be managed in local storage.
17+
18+
When deciding to put state in the URL, ask yourself:
19+
20+
- Do I need it to persist across page refresh?
21+
- Do I need to share it with others?
22+
- Do I need to link to it from other places?
23+
- Do I need to be able to bookmark it?
24+
- Do I need to be able to use the Back/Forward buttons to navigate to it?
25+
- Is it always going to be a small amount of data?
26+
27+
If the answer to any of these questions is no, then you might want to consider
28+
an alternative state storage solution.

0 commit comments

Comments
 (0)