Skip to content

Conversation

@franky47
Copy link
Member

@franky47 franky47 commented Oct 13, 2025

When calling the state updater function with { shallow: false, limitUrlUpdates: debounce(...) }, it would trigger a flush of the throttle queue to obtain the pending Promise to return, which caused unnecessary URL update calls to be made to the server.

We can obtain the pending Promise independently instead and avoid those flushes.

Tasks

  • Add a test to showcase the behaviour

@franky47 franky47 added the feature/time-safety Throttle, debounce, anything related to keeping URL updates time-safe. label Oct 13, 2025
@franky47 franky47 added this to the 🪵 Backlog milestone Oct 13, 2025
@vercel
Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
nuqs Ready Ready Preview Comment Oct 14, 2025 11:49am

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 13, 2025

pnpm add https://pkg.pr.new/nuqs@1172

commit: 830911e

This simulates the behaviour of other adapters,
and exposes the problem: uncleared pending updates
would cause a URL update to be emitted when flushing
the global throttle queue. They would be cleared on the next
push by a throttled update, but not by a debounced update
(until its timeout expires).
@franky47 franky47 merged commit 642cba1 into next Oct 14, 2025
30 checks passed
@franky47 franky47 deleted the fix/dont-flush-on-debounce branch October 14, 2025 13:32
@github-actions
Copy link

🎉 This PR is included in version 2.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@franky47 franky47 mentioned this pull request Oct 16, 2025
@franky47 franky47 removed this from the 🚀 Shipping next milestone Oct 16, 2025
I-3B pushed a commit to I-3B/nuqs that referenced this pull request Oct 25, 2025
aryasaatvik pushed a commit to aryasaatvik/nuqs that referenced this pull request Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/time-safety Throttle, debounce, anything related to keeping URL updates time-safe. released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants