The open source coding agent.
TypeScript
fix(desktop): type issue
Adam674febcf6057
diff --git a/packages/desktop/src/components/code.tsx b/packages/desktop/src/components/code.tsxindex 325f7b635ac..bbf7e28aaae 100644--- a/packages/desktop/src/components/code.tsx+++ b/packages/desktop/src/components/code.tsx@@ -99,13 +99,13 @@ export function Code(props: Props) {})}- const onSelectionChange = () => {+ const onSelectionChange = async () => {if (!container) returnif (isProgrammaticSelection) return// if (ctx.file.active()?.path !== local.path) returnconst d = getSelectionInContainer(container)if (!d) return- const p = ctx.file.node(local.path)?.selection+ const p = (await ctx.file.node(local.path))?.selectionif (p && p.startLine === d.sl && p.endLine === d.el && p.startChar === d.sch && p.endChar === d.ech) returnctx.file.select(local.path, { startLine: d.sl, startChar: d.sch, endLine: d.el, endChar: d.ech })}@@ -144,21 +144,21 @@ export function Code(props: Props) {})// Restore scroll position from store when content is ready- createEffect(() => {+ createEffect(async () => {const content = html()if (!container || !content) return- const top = ctx.file.node(local.path)?.scrollTop+ const top = (await ctx.file.node(local.path))?.scrollTopif (top !== undefined && container.scrollTop !== top) container.scrollTop = top})// Sync selection from store -> DOM- createEffect(() => {+ createEffect(async () => {const content = html()if (!container || !content) return// if (ctx.file.active()?.path !== local.path) returnconst codeEl = container.querySelector("code") as HTMLElement | undefinedif (!codeEl) return- const target = ctx.file.node(local.path)?.selection+ const target = (await ctx.file.node(local.path))?.selectionconst current = getSelectionInContainer(container)const sel = window.getSelection()if (!sel) returndiff --git a/packages/desktop/src/components/file-tree.tsx b/packages/desktop/src/components/file-tree.tsxindex a5d19f51e32..1347ecae6e5 100644--- a/packages/desktop/src/components/file-tree.tsx+++ b/packages/desktop/src/components/file-tree.tsx@@ -77,7 +77,7 @@ export default function FileTree(props: {<Collapsibleclass="w-full"forceMount={false}- open={local.file.node(node.path)?.expanded}+ // open={local.file.node(node.path)?.expanded}onOpenChange={(open) => (open ? local.file.expand(node.path) : local.file.collapse(node.path))}><Collapsible.Trigger>@@ -85,7 +85,7 @@ export default function FileTree(props: {<Collapsible.Arrow class="text-text-muted/60 ml-1" /><FileIconnode={node}- expanded={local.file.node(node.path).expanded}+ // expanded={local.file.node(node.path).expanded}class="text-text-muted/60 -ml-1"/></Node>