mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: document editor debounced
This commit is contained in:
parent
29e8e6c997
commit
b82f04ea04
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useRef, useState, ReactElement } from "react";
|
import React, { useEffect, useRef, useState, ReactElement, useCallback } from "react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useSWR, { MutatorOptions } from "swr";
|
import useSWR, { MutatorOptions } from "swr";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
@ -59,7 +59,7 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
|
|||||||
|
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
|
||||||
const { handleSubmit, reset, setValue, watch, getValues, control } = useForm<IPage>({
|
const { handleSubmit, setValue, watch, getValues, control } = useForm<IPage>({
|
||||||
defaultValues: { name: "", description_html: "" },
|
defaultValues: { name: "", description_html: "" },
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -328,9 +328,12 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
|
|||||||
description_html: "",
|
description_html: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const debouncedFormSave = debounce(async () => {
|
const debouncedFormSave = useCallback(
|
||||||
handleSubmit(updatePage)().finally(() => setIsSubmitting("submitted"));
|
debounce(async () => {
|
||||||
}, 1500);
|
handleSubmit(updatePage)().finally(() => setIsSubmitting("submitted"));
|
||||||
|
}, 1500),
|
||||||
|
[handleSubmit]
|
||||||
|
);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user