Просмотр исходного кода

Change return type (boolean -> void)

Shun Miyazawa 11 месяцев назад
Родитель
Сommit
c6f6986646
1 измененных файлов с 5 добавлено и 9 удалено
  1. 5 9
      packages/editor/src/client/services/unified-merge-view/index.ts

+ 5 - 9
packages/editor/src/client/services/unified-merge-view/index.ts

@@ -10,26 +10,22 @@ import { EditorView } from '@codemirror/view';
 import type { UseCodeMirrorEditor } from '..';
 
 
-export const acceptAllChunks = (view: EditorView): boolean => {
+export const acceptAllChunks = (view: EditorView): void => {
   // Get all chunks from the editor state
   const chunkData = getChunks(view.state);
-  if (!chunkData || chunkData.chunks.length === 0) return false;
+  if (!chunkData || chunkData.chunks.length === 0) {
+    return;
+  }
 
   // Get all chunks and sort them in reverse order by position
   const chunks = [...chunkData.chunks].sort((a, b) => b.fromB - a.fromB);
 
-  // Track if we've accepted at least one chunk
-  let accepted = false;
-
   // Process each chunk from bottom to top
   for (const chunk of chunks) {
     // Use a position inside the chunk (middle point is safe)
     const pos = chunk.fromB + Math.floor((chunk.endB - chunk.fromB) / 2);
-    const success = acceptChunk(view, pos);
-    if (success) accepted = true;
+    acceptChunk(view, pos);
   }
-
-  return accepted;
 };