Browse Source

fix: Simplify stableOnSave function in useKeymapExtension for better clarity

Shun Miyazawa 2 months ago
parent
commit
0d126d84af
1 changed files with 1 additions and 2 deletions
  1. 1 2
      packages/editor/src/client/stores/use-editor-settings.ts

+ 1 - 2
packages/editor/src/client/stores/use-editor-settings.ts

@@ -103,8 +103,7 @@ const useKeymapExtension = (
   useEffect(() => {
     const settingKeyMap = async (name?: KeyMapMode) => {
       // Pass a stable wrapper function that delegates to the ref
-      const stableOnSave =
-        onSaveRef.current != null ? () => onSaveRef.current?.() : undefined;
+      const stableOnSave = () => onSaveRef.current?.();
       setKeymapExtension(await getKeymap(name, stableOnSave));
     };
     settingKeyMap(keymapMode);