[codex] fix: guard trace ID clipboard copy (#3505)
Co-authored-by: Codex <[email protected]>
This commit is contained in:
1 parent
28107e89c2
commit
ea52bb1dbd
1 file changed
+26
-1
@@ -1423,6 +1423,31 @@ function SavedBackendListRow({
|
||||
: "bg-muted-foreground/40";
|
||||
const statusTooltip = connectionStatusText(environment.connection);
|
||||
const errorTraceId = environment.connection.traceId;
|
||||
const { copyToClipboard: copyTraceIdToClipboard } = useCopyToClipboard<{ traceId: string }>({
|
||||
target: "trace ID",
|
||||
onCopy: ({ traceId }) => {
|
||||
toastManager.add({
|
||||
type: "success",
|
||||
title: "Trace ID copied",
|
||||
description: traceId,
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
toastManager.add(
|
||||
stackedThreadToast({
|
||||
type: "error",
|
||||
title: "Could not copy trace ID",
|
||||
description: error.message,
|
||||
}),
|
||||
);
|
||||
},
|
||||
});
|
||||
const copyTraceId = useCallback(
|
||||
(traceId: string) => {
|
||||
copyTraceIdToClipboard(traceId, { traceId });
|
||||
},
|
||||
[copyTraceIdToClipboard],
|
||||
);
|
||||
const versionMismatch = resolveServerConfigVersionMismatch(environment.serverConfig);
|
||||
const sshTarget =
|
||||
environment.entry.target._tag === "SshConnectionTarget" &&
|
||||
@@ -1468,7 +1493,7 @@ function SavedBackendListRow({
|
||||
<button
|
||||
type="button"
|
||||
className="shrink-0 underline underline-offset-2"
|
||||
onClick={() => void navigator.clipboard.writeText(errorTraceId)}
|
||||
onClick={() => copyTraceId(errorTraceId)}
|
||||
>
|
||||
Copy trace ID
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user