-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add simple debounce functionality #6
Conversation
It seems I'm the principal frontend contributor for InvokeAI, a Stable Diffusion (AI Image Generation) application. We're using To debounce persistence calls on Anyways, just saying hi! |
- Add simple debounce functionality - If `persistDebounce` is provided, calls to persist will be debounced by the given amount of time and not throttled - If it is not provided, behaviour is idential (e.g. throttle), so this is a non-breaking change fix: revert unintentional changes to index.d.ts
cbd65c0
to
5822ce6
Compare
Pull Request Test Coverage Report for Build 4893527236
💛 - Coveralls |
Hi @psychedelicious, nice to meet you! The PR looks good to me, other than some minor things which I'll fix in a subsequent release:
For now I will make a release so you can be unblocked. Cheers, P.S.: I'll also be free to start working on something new soon (finalizing quite the project right now). |
@psychedelicious, version 3.3.0 is now on npm, have fun! :) |
@zewish Great, thanks for your prompt review and merge. We'd love to discuss the project! It's in a fascinating space and we have some cool frontend and backend stuff going on - like a shiny new graph execution engine backend with node editor UI and infinite image generation canvas. We're mid-migration to this new graph backend and API, so things are in flux, but we're pretty close to feature parity with the previous backend. We're also working on a commercial wrapper, providing additional enterprise features without compromising the strong OSS-first blood (the current commercial team was mostly hired from within the OSS project). |
persistDebounce
is provided, calls to persist will be debounced by the given amount of time and not throttledWe have a use-case for debouncing calls to the persist function - we want to totally avoid persistence-related execution until there is no change to state for X ms.
The persistence process has its own overhead before the storage driver is called, and we want to debounce that, so a debounced storage driver is not an option.
I'm not sure how to get that last little bit of test coverage and it bugs me!
I'm happy to extend this to be a more full-featured debounce (comparable to lodash) if that's desired. Another idea I had was to optionally accept a
persist()
wrapper function - so you could just pass lodash throttle/debounce and use that to wrap the persist call.