kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: use refs for comment submit/cancel shortcuts in TipTap handler

Stale closures in handleKeyDown kept initial empty content when using Cmd+Enter.

Tin a592d0a6 9ac30bbb

+9 -4
+9 -4
apps/web/src/components/activity/comment-editor.tsx
··· 187 187 const taskIdRef = useRef(taskId); 188 188 const ensureTaskIdRef = useRef(ensureTaskId); 189 189 const uploadSurfaceRef = useRef(uploadSurface); 190 + const onSubmitShortcutRef = useRef(onSubmitShortcut); 191 + const onCancelShortcutRef = useRef(onCancelShortcut); 192 + onSubmitShortcutRef.current = onSubmitShortcut; 193 + onCancelShortcutRef.current = onCancelShortcut; 190 194 const pendingImageInsertRef = useRef<{ 191 195 editor: Editor; 192 196 range?: SlashRange; ··· 809 813 } 810 814 811 815 if ((event.metaKey || event.ctrlKey) && event.key === "Enter") { 812 - if (!readOnly && !disabled && onSubmitShortcut) { 816 + const submit = onSubmitShortcutRef.current; 817 + if (!readOnly && !disabled && submit) { 813 818 event.preventDefault(); 814 - onSubmitShortcut(); 819 + submit(); 815 820 return true; 816 821 } 817 822 } ··· 820 825 event.key === "Escape" && 821 826 !readOnly && 822 827 !disabled && 823 - onCancelShortcut 828 + onCancelShortcutRef.current 824 829 ) { 825 830 event.preventDefault(); 826 - onCancelShortcut(); 831 + onCancelShortcutRef.current(); 827 832 return true; 828 833 } 829 834