Skip to content

Remove warning with debounce + shallow:true #1149

@franky47

Description

@franky47

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:

Image

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions