diff options
| author | Adam <[email protected]> | 2026-02-04 11:19:03 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-04 11:19:03 -0600 |
| commit | ce87121067dfe2d8cfc6c16791ff444a60f5de1d (patch) | |
| tree | 0da0823d7726c2e8434fedb608f8a2e6f1f28035 /packages/app/src/context | |
| parent | ecd7854853b7f91fb1e65967bc2aef811dee7216 (diff) | |
| download | opencode-ce87121067dfe2d8cfc6c16791ff444a60f5de1d.tar.gz opencode-ce87121067dfe2d8cfc6c16791ff444a60f5de1d.zip | |
fix(app): clear comments on prompt submission (#12148)
Diffstat (limited to 'packages/app/src/context')
| -rw-r--r-- | packages/app/src/context/comments.tsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/app/src/context/comments.tsx b/packages/app/src/context/comments.tsx index f55514587..d51c16352 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 } = createSimpleCont all: () => 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(), |
