Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

init sync to avoid first render with button enabled

Thiago Araujo da Silva815c1c7511c8
diff --git a/frontend/src/components/auth/CodeInputStep.tsx b/frontend/src/components/auth/CodeInputStep.tsx
index 7fc9589ad5..7e88f87283 100644
--- a/frontend/src/components/auth/CodeInputStep.tsx
+++ b/frontend/src/components/auth/CodeInputStep.tsx
@@ -69,18 +69,9 @@ export default function CodeInputStep({
const [code, setCode] = useState("");
- // Store absolute expiry time (source of truth)
- const endTimeRef = useRef<number>(0);
- // Force UI refresh every second
+ const endTimeRef = useRef<number>(initialCooldown > 0 ? Date.now() + initialCooldown * 1000 : 0);
const [, forceRender] = useState(0);
- // Initialize cooldown from server
- useEffect(() => {
- if (initialCooldown > 0) {
- endTimeRef.current = Date.now() + initialCooldown * 1000;
- }
- }, [initialCooldown]);
-
// Tick every second
useEffect(() => {
const timer = setInterval(() => {