-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(bridge,nitro,nuxi,nuxt3,vite): ensure debounced/async handlers run in order #3656
Conversation
βοΈ Deploy Preview for nuxt3-docs canceled. π¨ Explore the source changes: 9acb39f π Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/62306f1d05fa67000813b074 |
|
The reason I've combined debounce.promise + debounce is that it will wait for the previous promise to resolve, and then run the function again, ensuring the latest changes are reflected. What would you say is the purpose of the debouncing effect? |
Awaiting on the promise and combining are fine. Changing debounce delay from |
I think I might be misunderstanding you. The current implementation will use both first and last change, as I've explained. Might be worth considering not debouncing then, because honestly the experience of speed without the artificial 300ms delay is π₯ |
See this sandbox please: https://stackblitz.com/edit/node-vnqatc?dev=dev&file=index.mjs Running pdebounce with 1ms saves one delay but randomly missing last update (v3 should normally be shown in output) |
As a regression of this PR, the last build might still be skipped. We are working on a better solutioon. |
π Linked issue
resolves nuxt/nuxt#13492
β Type of change
π Description
Across the nuxt codebase, this PR uses
debounce
+debounce.promise
to prevent initialising a new handler before the old one has finished running (which should prevent double access to files, for example, or multiple callbacks pushing the same plugin toapp.plugins
, as in the issue linked above).At the same time, we drop the timeout from (for example) 300 to 1. This leads to a significant increase in DX as it feels much faster.
This PR also:
.nuxt
was not triggering a reload (such as.nuxtignore
).env
and.nuxtrc
files to trigger a full nuxt reloadπ Checklist