Skip to content

Commit 23f4cbc

Browse files
committed
refactor(context-menu): reduce string computation
1 parent 93d11c0 commit 23f4cbc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

webview-ui/src/components/chat/ContextMenu.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
111111
if (option.value) {
112112
// remove trailing slash
113113
const path = removeLeadingNonAlphanumeric(option.value || "").replace(/\/$/, "")
114-
const filename = path.split("/").at(-1)
115-
const folderPath = path.split("/").slice(0, -1).join("/")
114+
const pathList = path.split("/")
115+
const filename = pathList.at(-1)
116+
const folderPath = pathList.slice(0, -1).join("/")
116117
return (
117118
<div
118119
style={{

0 commit comments

Comments
 (0)