Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit206e215

Browse files
committed
fix: get all tests working
1 parentb4c6648 commit206e215

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎site/src/hooks/useClipboard.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Modified version of the useClipboard hook from Coder core.
33
*@see {@link https://github.com/coder/coder/blob/main/site/src/hooks/useClipboard.ts}
44
*/
5+
6+
import{displayError}from"components/GlobalSnackbar/utils";
57
import{useCallback,useEffect,useRef,useState}from"react";
68
import{useEffectEvent}from"./hookPolyfills";
79

@@ -40,7 +42,7 @@ export type UseClipboardResult = Readonly<{
4042
}>;
4143

4244
exportconstuseClipboard=(input?:UseClipboardInput):UseClipboardResult=>{
43-
const{onError:errorCallback, clearErrorOnSuccess=true}=input??{};
45+
const{ onError=displayError, clearErrorOnSuccess=true}=input??{};
4446

4547
const[showCopiedSuccess,setShowCopiedSuccess]=useState(false);
4648
const[error,setError]=useState<Error>();
@@ -53,9 +55,7 @@ export const useClipboard = (input?: UseClipboardInput): UseClipboardResult => {
5355
returnclearTimeoutOnUnmount;
5456
},[]);
5557

56-
conststableOnError=useEffectEvent(()=>{
57-
errorCallback?.(COPY_FAILED_MESSAGE);
58-
});
58+
conststableOnError=useEffectEvent(()=>onError(COPY_FAILED_MESSAGE));
5959
consthandleSuccessfulCopy=useEffectEvent(()=>{
6060
setShowCopiedSuccess(true);
6161
if(clearErrorOnSuccess){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp