(view: EditorView, taskPath?: string)
| 651 | |
| 652 | // Helper function to dispatch task update effects to an editor view |
| 653 | export function dispatchTaskUpdate(view: EditorView, taskPath?: string): void { |
| 654 | // Validate that view is a proper EditorView with dispatch method |
| 655 | if (!view || typeof view.dispatch !== "function") { |
| 656 | tasknotesLogger.warn("Invalid EditorView passed to dispatchTaskUpdate:", { |
| 657 | category: "validation", |
| 658 | operation: "invalid-editorview-passed-dispatchtaskupdate", |
| 659 | details: { value: view }, |
| 660 | }); |
| 661 | return; |
| 662 | } |
| 663 | |
| 664 | try { |
| 665 | view.dispatch({ |
| 666 | effects: [taskUpdateEffect.of({ taskPath })], |
| 667 | }); |
| 668 | } catch (error) { |
| 669 | tasknotesLogger.error("Error dispatching task update:", { |
| 670 | category: "validation", |
| 671 | operation: "dispatching-task-update", |
| 672 | error: error, |
| 673 | }); |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | // Export the service for use elsewhere |
| 678 | export { TaskLinkDetectionService }; |
no test coverage detected