vite-plugin-full-reload icon indicating copy to clipboard operation
vite-plugin-full-reload copied to clipboard

Optimize multiple changes on the same delay

Open jpamador opened this issue 2 years ago • 6 comments

When there are multiple changes within the delay window right now they are just queue instead of doing one per window.

jpamador avatar Feb 15 '23 23:02 jpamador

Hi there!

Would you describe your use case?

ElMassimo avatar Feb 16 '23 12:02 ElMassimo

Hi!

I have an application that on certain occasions does several changes in a row to the backend. We are using your plugin (thanks btw!) with a delay of 2 seconds to give time for the backend to cool down, but what I have seen is that let's say I do 3 changes to the backend on those 2 seconds, I will then see 3 reloads, this change is to "aggregate" those changes in the delay window and just do one

jpamador avatar Feb 16 '23 18:02 jpamador

several changes in a row to the backend

Modifying files? Can you elaborate further?

ElMassimo avatar Feb 16 '23 18:02 ElMassimo

I'm just developing an application with frontend and backend using JS, for development purposes I have a big window on the auto-refresh so that it give me time to do changes to different files in the backend before it refreshes so that its a complete change (that may involve changing 3 files). But as I mentioned before, with the current set up, when the window is up, I get 3 refreshed back to back instead of 1.

jpamador avatar Feb 16 '23 19:02 jpamador

Essentially this is debouncing (e.g. https://browsersync.io/docs/options#option-reloadDebounce). What he’s saying (if I’m not mistaken) is that even though there’s currently a delay, even if you make several changes very quickly within that delay, they each trigger separate reloads (based on what I’m reading above, I haven’t installed this yet 😅).

patricknelson avatar Apr 29 '23 10:04 patricknelson

@ElMassimo @jpamador I think that this PR is something that also might help and does what we all need in a very controlled and simple way?

Or maybe I'm misunderstanding something @jpamador?

bjufre avatar Jun 30 '23 08:06 bjufre