Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(desktop): add missing handleRefresh dependency to useEffect

Jiang Bohan2b3baa27a8a5
diff --git a/apps/desktop/src/components/qr-code.tsx b/apps/desktop/src/components/qr-code.tsx
index 35ba0d8d95..f70f8ed2a6 100644
--- a/apps/desktop/src/components/qr-code.tsx
+++ b/apps/desktop/src/components/qr-code.tsx
@@ -84,21 +84,6 @@ export function ConnectionQRCode({
return `multica://connect?${params.toString()}`
}, [gateway, hubId, agentId, token, expiresAt])
- // Countdown timer
- useEffect(() => {
- const timer = setInterval(() => {
- const remaining = Math.max(0, Math.floor((expiresAt - Date.now()) / 1000))
- setRemainingSeconds(remaining)
-
- // Auto-refresh when expired
- if (remaining === 0) {
- handleRefresh()
- }
- }, 1000)
-
- return () => clearInterval(timer)
- }, [expiresAt])
-
// Refresh token handler
const handleRefresh = useCallback(() => {
const newToken = generateToken()
@@ -120,6 +105,21 @@ export function ConnectionQRCode({
}
}, [gateway, hubId, agentId, expirySeconds, onRefresh])
+ // Countdown timer
+ useEffect(() => {
+ const timer = setInterval(() => {
+ const remaining = Math.max(0, Math.floor((expiresAt - Date.now()) / 1000))
+ setRemainingSeconds(remaining)
+
+ // Auto-refresh when expired
+ if (remaining === 0) {
+ handleRefresh()
+ }
+ }, 1000)
+
+ return () => clearInterval(timer)
+ }, [expiresAt, handleRefresh])
+
// Copy link handler
const handleCopyLink = async () => {
try {