forked from github/plane
fix: added useCallback for controlling debounce function triggering on every rerendeer
Added a useCallback function, which helps keeping only one version of the debounce function, what happens is that when we type in the editor, the rerenders produces multiple debounce function, which all triggers together after the specifier amount of time, making many request to backend, consiquently failing the debounce. Now useCallback will give only one function even if the rerenders are happening which fixes the issue
This commit is contained in:
parent
b82f04ea04
commit
01874cb2db
@ -328,6 +328,7 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
|
||||
description_html: "",
|
||||
});
|
||||
|
||||
// ADDING updatePage TO DEPENDENCY ARRAY PRODUCES ADVERSE EFFECTS
|
||||
const debouncedFormSave = useCallback(
|
||||
debounce(async () => {
|
||||
handleSubmit(updatePage)().finally(() => setIsSubmitting("submitted"));
|
||||
|
Loading…
Reference in New Issue
Block a user