Skip to content

Commit 8131cd4

Browse files
authored
Do not allow user to copy non-existent sha (#4617)
1 parent 9914da2 commit 8131cd4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

webview/src/experiments/components/table/body/RowContextMenu.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ const getRunResumeOptions = (
215215

216216
const getSingleSelectMenuOptions = (
217217
id: string,
218-
sha: string,
218+
sha: string | undefined,
219219
isWorkspace: boolean,
220220
projectHasCheckpoints: boolean,
221221
hasRunningWorkspaceExperiment: boolean,
@@ -268,7 +268,7 @@ const getSingleSelectMenuOptions = (
268268
MessageFromWebviewType.CREATE_BRANCH_FROM_EXPERIMENT
269269
),
270270
{
271-
disabled: isWorkspace,
271+
disabled: isWorkspace || !sha,
272272
id: MessageFromWebviewType.COPY_TO_CLIPBOARD,
273273
label: 'Copy Sha',
274274
message: {
@@ -324,7 +324,7 @@ const getSingleSelectMenuOptions = (
324324

325325
const getContextMenuOptions = (
326326
id: string,
327-
sha: string,
327+
sha: string | undefined,
328328
branch: string | undefined | typeof WORKSPACE_BRANCH,
329329
isWorkspace: boolean,
330330
projectHasCheckpoints: boolean,
@@ -382,7 +382,7 @@ export const RowContextMenu: React.FC<RowProp> = ({
382382
const contextMenuOptions = useMemo(() => {
383383
return getContextMenuOptions(
384384
id,
385-
sha as string,
385+
sha,
386386
branch,
387387
isWorkspace,
388388
projectHasCheckpoints,

0 commit comments

Comments
 (0)