docs: share page write tool bug

This commit is contained in:
Jay V
2025-06-27 13:25:15 -04:00
parent 5773d9d1a3
commit 391c837b37
2 changed files with 34 additions and 7 deletions

View File

@@ -84,7 +84,7 @@ function scrollToAnchor(id: string) {
el.scrollIntoView({ behavior: "smooth" })
}
function stripWorkingDirectory(filePath: string, workingDir?: string) {
function stripWorkingDirectory(filePath?: string, workingDir?: string) {
if (filePath === undefined || workingDir === undefined) return filePath
const prefix = workingDir.endsWith("/") ? workingDir : workingDir + "/"
@@ -1228,9 +1228,9 @@ export default function Share(props: {
const path = createMemo(() =>
toolData()?.args.path !== data().rootDir
? stripWorkingDirectory(
toolData()?.args.path,
data().rootDir,
)
toolData()?.args.path,
data().rootDir,
)
: toolData()?.args.path,
)
@@ -1391,7 +1391,7 @@ export default function Share(props: {
{(_part) => {
const filePath = createMemo(() =>
stripWorkingDirectory(
toolData()?.args.filePath,
toolData()?.args?.filePath,
data().rootDir,
),
)
@@ -1430,7 +1430,7 @@ export default function Share(props: {
<div data-part-tool-result>
<ErrorPart>
{formatErrorString(
toolData()?.result,
toolData()?.result
)}
</ErrorPart>
</div>
@@ -1449,7 +1449,7 @@ export default function Share(props: {
<div data-part-tool-code>
<CodeBlock
lang={getShikiLang(filePath())}
code={args.content}
code={toolData()?.args?.content}
/>
</div>
</Show>