Split transactions when applying suggestions (#465)

This commit is contained in:
Jeremy 2024-10-30 20:36:45 +05:30 committed by GitHub
parent b3cb0ea755
commit 029cbb835e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 75 additions and 20 deletions

View file

@ -180,13 +180,18 @@ export function Canvas({
);
const handleEditorChange = useCallback(
(updatedContent: string) => {
(updatedContent: string, debounce: boolean) => {
if (document && updatedContent !== document.content) {
debouncedHandleEditorChange(updatedContent);
if (debounce) {
debouncedHandleEditorChange(updatedContent);
} else {
handleContentChange(updatedContent);
}
setIsContentDirty(true);
}
},
[document, debouncedHandleEditorChange]
[document, debouncedHandleEditorChange, handleContentChange]
);
function getDocumentContentById(index: number) {