diff options
| author | Adam <[email protected]> | 2026-03-13 06:27:58 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-13 06:27:58 -0500 |
| commit | 270cb0b8b4265ac0965ac8b94a58a3bca86fa558 (patch) | |
| tree | 5a37c81bec1dea75b5c24f6aa8fb6a762d438f64 /packages/ui/src/components/line-comment-annotations.tsx | |
| parent | 46ba9c81703fc6e7db7e623a607eeaab94fcd00f (diff) | |
| download | opencode-270cb0b8b4265ac0965ac8b94a58a3bca86fa558.tar.gz opencode-270cb0b8b4265ac0965ac8b94a58a3bca86fa558.zip | |
chore: cleanup (#17284)
Diffstat (limited to 'packages/ui/src/components/line-comment-annotations.tsx')
| -rw-r--r-- | packages/ui/src/components/line-comment-annotations.tsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/ui/src/components/line-comment-annotations.tsx b/packages/ui/src/components/line-comment-annotations.tsx index 6b072d9c5..3505487eb 100644 --- a/packages/ui/src/components/line-comment-annotations.tsx +++ b/packages/ui/src/components/line-comment-annotations.tsx @@ -1,5 +1,6 @@ import { type DiffLineAnnotation, type SelectedLineRange } from "@pierre/diffs" import { createEffect, createMemo, createSignal, onCleanup, Show, type Accessor, type JSX } from "solid-js" +import { createStore } from "solid-js/store" import { render as renderSolid } from "solid-js/web" import { createHoverCommentUtility } from "../pierre/comment-hover" import { cloneSelectedLineRange, formatSelectedLineLabel, lineInSelectedRange } from "../pierre/selection-bridge" @@ -200,8 +201,14 @@ export function createLineCommentAnnotationRenderer<T>(props: { } export function createLineCommentState<T>(props: LineCommentStateProps<T>) { - const [draft, setDraft] = createSignal("") - const [editing, setEditing] = createSignal<T | null>(null) + const [state, setState] = createStore({ + draft: "", + editing: null as T | null, + }) + const draft = () => state.draft + const setDraft = (value: string) => setState("draft", value) + const editing = () => state.editing + const setEditing = (value: T | null) => setState("editing", typeof value === "function" ? () => value : value) const toRange = (range: SelectedLineRange | null) => (range ? cloneSelectedLineRange(range) : null) const setSelected = (range: SelectedLineRange | null) => { @@ -261,7 +268,7 @@ export function createLineCommentState<T>(props: LineCommentStateProps<T>) { closeComment() setSelected(range) props.setCommenting(null) - setEditing(() => id) + setEditing(id) setDraft(value) } |
