The open source coding agent.
TypeScript
fix(app): clear comments on prompt submission (#12148)
Adamce87121067df
diff --git a/packages/app/src/context/comments.tsx b/packages/app/src/context/comments.tsxindex f5551458748..d51c1635248 100644--- a/packages/app/src/context/comments.tsx+++ b/packages/app/src/context/comments.tsx@@ -70,6 +70,14 @@ function createCommentSession(dir: string, id: string | undefined) {setFocus((current) => (current?.id === id ? null : current))}+ const clear = () => {+ batch(() => {+ setStore("comments", {})+ setFocus(null)+ setActive(null)+ })+ }+const all = createMemo(() => {const files = Object.keys(store.comments)const items = files.flatMap((file) => store.comments[file] ?? [])@@ -82,6 +90,7 @@ function createCommentSession(dir: string, id: string | undefined) {all,add,remove,+ clear,focus: createMemo(() => state.focus),setFocus,clearFocus: () => setFocus(null),@@ -144,6 +153,7 @@ export const { use: useComments, provider: CommentsProvider } = createSimpleContall: () => session().all(),add: (input: Omit<LineComment, "id" | "time">) => session().add(input),remove: (file: string, id: string) => session().remove(file, id),+ clear: () => session().clear(),focus: () => session().focus(),setFocus: (focus: CommentFocus | null) => session().setFocus(focus),clearFocus: () => session().clearFocus(),diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsxindex f74eadc87be..328e66a8373 100644--- a/packages/app/src/pages/session.tsx+++ b/packages/app/src/pages/session.tsx@@ -2603,7 +2603,10 @@ export default function Page() {}}newSessionWorktree={newSessionWorktree()}onNewSessionWorktreeReset={() => setStore("newSessionWorktree", "main")}- onSubmit={resumeScroll}+ onSubmit={() => {+ comments.clear()+ resumeScroll()+ }}/></Show></div>