mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
fix: conditional hook rule
This commit is contained in:
1 parent
61cee4187d
commit
dd71508f2e
1 file changed
+16
-14
@@ -323,6 +323,22 @@ const Results = ({ results }) => {
|
||||
['INPUT', 'TEXTAREA']
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
let timeoutId = 0
|
||||
|
||||
if (copiedCell) {
|
||||
timeoutId = setTimeout(() => {
|
||||
setCopiedCell(undefined)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
return () => {
|
||||
// we need to clear previous timeout to prevent checkmark flickering
|
||||
// when clicking `Copy` btn multiple times in a short time
|
||||
timeoutId && clearTimeout(timeoutId)
|
||||
}
|
||||
}, [copiedCell])
|
||||
|
||||
if (results?.error) {
|
||||
return (
|
||||
<div className="bg-table-header-light dark:bg-table-header-dark">
|
||||
@@ -338,20 +354,6 @@ const Results = ({ results }) => {
|
||||
)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let timeoutId = 0
|
||||
|
||||
if (copiedCell) {
|
||||
timeoutId = setTimeout(() => {
|
||||
setCopiedCell(undefined)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
return () => {
|
||||
timeoutId && clearTimeout(timeoutId)
|
||||
}
|
||||
}, [copiedCell])
|
||||
|
||||
const handleCopyClick = (column, row, rowIndex) => {
|
||||
copyToClipboard(formatClipboardValue(row[column]), () => {
|
||||
setCopiedCell(`${column},${rowIndex}`)
|
||||
|
||||
Reference in new issue
Block a user