Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions agents-docs/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const isProd = process.env.NODE_ENV === 'production';

const config: NextConfig = {
reactStrictMode: true,
reactCompiler: {
// Fail the build on any compiler diagnostic
panicThreshold: 'all_errors',
},
// Increase timeout for static page generation in CI environments
staticPageGenerationTimeout: 120, // 2 minutes instead of default 60 seconds
images: {
Expand Down
11 changes: 7 additions & 4 deletions agents-docs/src/components/hooks/use-copy-button.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
'use client';
import { type MouseEventHandler, useCallback, useEffect, useRef, useState } from 'react';
import { type MouseEventHandler, useEffect, useRef, useState } from 'react';

export function useCopyButton(onCopy: () => void): [checked: boolean, onClick: MouseEventHandler] {
const [checked, setChecked] = useState(false);
const timeoutRef = useRef<number | null>(null);
const callbackRef = useRef(onCopy);
callbackRef.current = onCopy;

const onClick: MouseEventHandler = useCallback(() => {
useEffect(() => {
callbackRef.current = onCopy;
}, [onCopy]);

const onClick: MouseEventHandler = () => {
if (timeoutRef.current) window.clearTimeout(timeoutRef.current);
timeoutRef.current = window.setTimeout(() => {
setChecked(false);
}, 1500);
callbackRef.current();
setChecked(true);
}, []);
};

// Avoid updates after being unmounted
useEffect(() => {
Expand Down
Loading