mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-31 23:11:28 +01:00
fix: wsh error copy rewrite (#1770)
The previous version of this was giving undefined values for some users. This rewrites it and removes an unnecessary memo that may have been causing the issue.
This commit is contained in:
parent
ad3113e46e
commit
42766d096a
@ -422,21 +422,20 @@ const ConnStatusOverlay = React.memo(
|
|||||||
setShowWshError(showWshErrorTemp);
|
setShowWshError(showWshErrorTemp);
|
||||||
}, [connStatus, wshConfigEnabled]);
|
}, [connStatus, wshConfigEnabled]);
|
||||||
|
|
||||||
const errorText = React.useMemo(() => {
|
const handleCopy = React.useCallback(
|
||||||
const errTexts = [];
|
async (e: React.MouseEvent) => {
|
||||||
if (showError) {
|
const errTexts = [];
|
||||||
errTexts.push(`error: ${connStatus.error}`);
|
if (showError) {
|
||||||
}
|
errTexts.push(`error: ${connStatus.error}`);
|
||||||
if (showWshError) {
|
}
|
||||||
errTexts.push(`unable to use wsh: ${connStatus.error}`);
|
if (showWshError) {
|
||||||
}
|
errTexts.push(`unable to use wsh: ${connStatus.wsherror}`);
|
||||||
return errTexts.join("\n");
|
}
|
||||||
}, [showError, connStatus.error, showWshError, connStatus.wsherror]);
|
const textToCopy = errTexts.join("\n");
|
||||||
|
await navigator.clipboard.writeText(textToCopy);
|
||||||
const handleCopy = async (e: React.MouseEvent) => {
|
},
|
||||||
let textToCopy = errorText;
|
[showError, showWshError, connStatus.error, connStatus.wsherror]
|
||||||
await navigator.clipboard.writeText(textToCopy);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
if (!showWshError && (isLayoutMode || connStatus.status == "connected" || connModalOpen)) {
|
if (!showWshError && (isLayoutMode || connStatus.status == "connected" || connModalOpen)) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user