:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(desktop): clear prompt after branch confirmation (#85864)
Dylan Martincdecdb271a19
diff --git a/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts b/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.tsindex 468a2e93fd61..ab67918d0744 100644--- a/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts+++ b/products/desktop/packages/ui/src/features/message-editor/tiptap/useTiptapEditor.ts@@ -779,6 +779,14 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {// eslint-disable-next-line react-hooks/exhaustive-deps}, [draft.restoredAttachments, updateAttachments]);+ const clear = useCallback(() => {+ editor?.commands.clearContent();+ prevBashModeRef.current = false;+ pasteCountRef.current = 0;+ updateAttachments([]);+ draft.clearDraft();+ }, [editor, draft, updateAttachments]);+const submit = useCallback(() => {if (!editor) return;if (disabled || submitDisabled) return;@@ -792,11 +800,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {const doClear = () => {if (!clearOnSubmit) return;- editor.commands.clearContent();- prevBashModeRef.current = false;- pasteCountRef.current = 0;- updateAttachments([]);- draft.clearDraft();+ clear();};if (enableBashMode && isBashModeDoc(editor, text)) {@@ -813,7 +817,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {const serialized = contentToXml(content);if (callbackRefs.current.onBeforeSubmit) {- if (!callbackRefs.current.onBeforeSubmit(serialized, doClear)) {+ if (!callbackRefs.current.onBeforeSubmit(serialized, clear)) {return;}}@@ -832,7 +836,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {clearOnSubmit,attachments,enableBashMode,- updateAttachments,+ clear,]);submitRef.current = submit;@@ -845,12 +849,6 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {}}, [editor]);const blur = useCallback(() => editor?.commands.blur(), [editor]);- const clear = useCallback(() => {- editor?.commands.clearContent();- prevBashModeRef.current = false;- updateAttachments([]);- draft.clearDraft();- }, [editor, draft, updateAttachments]);const getText = useCallback(() => editor?.getText() ?? "", [editor]);const setContent = useCallback((content: string | EditorContent) => {