diff options
| author | adamelmore <[email protected]> | 2026-01-26 10:04:59 -0600 |
|---|---|---|
| committer | adamelmore <[email protected]> | 2026-01-26 11:26:17 -0600 |
| commit | d05ed5ca83e03904c7c3dda23a6dcccfd607bdce (patch) | |
| tree | 1afcb055bcedf8b477472f0b25432b318a95f53b /packages/app/src/context/comments.tsx | |
| parent | 37f1a1a4ef36eacb60ad5493db8aeb1130c5fa91 (diff) | |
| download | opencode-d05ed5ca83e03904c7c3dda23a6dcccfd607bdce.tar.gz opencode-d05ed5ca83e03904c7c3dda23a6dcccfd607bdce.zip | |
chore(app): createStore over signals
Diffstat (limited to 'packages/app/src/context/comments.tsx')
| -rw-r--r-- | packages/app/src/context/comments.tsx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/app/src/context/comments.tsx b/packages/app/src/context/comments.tsx index 41123042d..f55514587 100644 --- a/packages/app/src/context/comments.tsx +++ b/packages/app/src/context/comments.tsx @@ -1,4 +1,4 @@ -import { batch, createMemo, createRoot, createSignal, onCleanup } from "solid-js" +import { batch, createMemo, createRoot, onCleanup } from "solid-js" import { createStore } from "solid-js/store" import { createSimpleContext } from "@opencode-ai/ui/context" import { useParams } from "@solidjs/router" @@ -37,8 +37,16 @@ function createCommentSession(dir: string, id: string | undefined) { }), ) - const [focus, setFocus] = createSignal<CommentFocus | null>(null) - const [active, setActive] = createSignal<CommentFocus | null>(null) + const [state, setState] = createStore({ + focus: null as CommentFocus | null, + active: null as CommentFocus | null, + }) + + const setFocus = (value: CommentFocus | null | ((value: CommentFocus | null) => CommentFocus | null)) => + setState("focus", value) + + const setActive = (value: CommentFocus | null | ((value: CommentFocus | null) => CommentFocus | null)) => + setState("active", value) const list = (file: string) => store.comments[file] ?? [] @@ -74,10 +82,10 @@ function createCommentSession(dir: string, id: string | undefined) { all, add, remove, - focus: createMemo(() => focus()), + focus: createMemo(() => state.focus), setFocus, clearFocus: () => setFocus(null), - active: createMemo(() => active()), + active: createMemo(() => state.active), setActive, clearActive: () => setActive(null), } |
