diff options
| author | Jay V <[email protected]> | 2025-06-12 13:11:29 -0400 |
|---|---|---|
| committer | Jay V <[email protected]> | 2025-06-12 13:11:34 -0400 |
| commit | 662b6b125833ace803ef33040b1343a43bd30b60 (patch) | |
| tree | abf298f5fbd73cf06caad442fc614761d05afe33 | |
| parent | f0dbe40522b28262549fcffd6b214b47e85603c7 (diff) | |
| download | opencode-662b6b125833ace803ef33040b1343a43bd30b60.tar.gz opencode-662b6b125833ace803ef33040b1343a43bd30b60.zip | |
share page handle undefined
| -rw-r--r-- | packages/web/src/components/Share.tsx | 31 | ||||
| -rw-r--r-- | packages/web/src/components/markdownview.module.css | 5 |
2 files changed, 28 insertions, 8 deletions
diff --git a/packages/web/src/components/Share.tsx b/packages/web/src/components/Share.tsx index 3c1b4c753..3625c57e9 100644 --- a/packages/web/src/components/Share.tsx +++ b/packages/web/src/components/Share.tsx @@ -167,6 +167,8 @@ export function getDiagnostics( ): string[] { const result: string[] = [] + if (diagnosticsByFile === undefined) return result + for (const diags of Object.values(diagnosticsByFile)) { for (const d of diags) { // Only keep diagnostics explicitly marked as Error (severity === 1) @@ -1395,6 +1397,7 @@ export default function Share(props: { part().toolInvocation.toolCallId ], ) + const hasError = metadata()?.error const args = part().toolInvocation.args const filePath = args.filePath const diagnostics = createMemo(() => @@ -1429,13 +1432,27 @@ export default function Share(props: { <span data-element-label>Edit</span> <b>{filePath}</b> </span> - <div data-part-tool-edit> - <DiffView - class={styles["diff-code-block"]} - diff={metadata()?.diff} - lang={getFileType(filePath)} - /> - </div> + <Switch> + <Match when={hasError}> + <div data-part-tool-result> + <TextPart + expand + data-size="sm" + data-color="dimmed" + text={metadata()?.message} + /> + </div> + </Match> + <Match when={false}> + <div data-part-tool-edit> + <DiffView + class={styles["diff-code-block"]} + diff={metadata()?.diff} + lang={getFileType(filePath)} + /> + </div> + </Match> + </Switch> <Show when={diagnostics().length > 0}> <TextPart data-size="sm" diff --git a/packages/web/src/components/markdownview.module.css b/packages/web/src/components/markdownview.module.css index 8b7d02e97..887fec38d 100644 --- a/packages/web/src/components/markdownview.module.css +++ b/packages/web/src/components/markdownview.module.css @@ -12,8 +12,11 @@ margin-bottom: 1rem; } - ul, ol { + list-style-position: inside; + padding-left: 0.75rem; + } + ul { padding-left: 1.5rem; } |
