Skip to content

Commit

Permalink
Merge pull request #287 from mu-hun/wailt-for-ready-before-destruct
Browse files Browse the repository at this point in the history
Fix: Avoid "Abort async" error by utilizing waitForReady API in Jodit destruct handling
  • Loading branch information
xdan authored Jan 19, 2025
2 parents 6c2bf8c + 8588190 commit b05e978
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/JoditEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ const JoditEditor = forwardRef<IJodit, Props>(
}

return () => {
if (jodit) {
if (jodit.isReady) {
jodit.destruct();
} else {
jodit.waitForReady().then((joditInstance) => joditInstance.destruct());
}
};
}, [JoditConstructor, config, editorRef]);
Expand Down

0 comments on commit b05e978

Please sign in to comment.