MCPcopy Create free account
hub / github.com/coder/coder / markSuccess

Function markSuccess

site/src/hooks/useClipboard.ts:62–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 const copyToClipboard = useCallback(
61 async (textToCopy: string) => {
62 const markSuccess = () => {
63 lastCopiedTextRef.current = textToCopy;
64 setShowCopiedSuccess(true);
65 if (clearErrorOnSuccess) {
66 setError(undefined);
67 }
68 timeoutIdRef.current = window.setTimeout(() => {
69 setShowCopiedSuccess(false);
70 }, CLIPBOARD_TIMEOUT_MS);
71 };
72
73 try {
74 await navigator.clipboard.writeText(textToCopy);

Callers 1

useClipboardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected