-
-
Notifications
You must be signed in to change notification settings - Fork 216
Description
In #1104, we added a warning to steer users towards using debounce with shallow: false
, for controlling when server requests are sent.
However, there is a case for applying debounce in client-only states: avoiding polluting the browser history.
There are two histories in browsers:
- The history stack, which you can push on with the
{ history: 'push' }
option, otherwise it replaces the current entry. This one is navigated with the Back/Forward browser buttons, and can usually be inspected by long-pressing Back. - The global history, which you can inspect in your browser's History menu.
The global history will record any change to the URL as a new entry, and there doesn't seem to be a way to control that (it's also browser-specific). This makes using high-frequency inputs (eg: search inputs or sliders) a jarring experience for user, as it pollutes their browser history. Example with Vercel Domains which uses nuqs:

In this case, using debounce does help reduce noise in the global history, at the cost of a less reactive URL. I believe we should give users the choice, and so the warning becomes a bit obnoxious.
Suggestions:
- Remove the warning
- Amend the docs to educate about history pollution and how to use debounce to solve it
- But also press on that it doesn't debounce the local state