Merge pull request #3867 from karyanayandi/fix/lazy-initializer-for-usestate

fix: use lazy initializer for useState with function calls
This commit is contained in:
Narciso E. Núñez Arias
2026-08-06 11:40:29 -04:00
committed by GitHub
2 changed files with 4 additions and 2 deletions
@@ -63,7 +63,7 @@ export const ShowRequests = () => {
const [dateRange, setDateRange] = useState<{ const [dateRange, setDateRange] = useState<{
from: Date | undefined; from: Date | undefined;
to: Date | undefined; to: Date | undefined;
}>(getDefaultDateRange()); }>(() => getDefaultDateRange());
// Check if logs exist to determine if traefik has been reloaded // Check if logs exist to determine if traefik has been reloaded
// Only fetch when active to minimize network calls // Only fetch when active to minimize network calls
@@ -32,7 +32,9 @@ export const TerminalModal = ({
serverId, serverId,
asButton = false, asButton = false,
}: Props) => { }: Props) => {
const [terminalKey, setTerminalKey] = useState<string>(getTerminalKey()); const [terminalKey, setTerminalKey] = useState<string>(() =>
getTerminalKey(),
);
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const isLocalServer = serverId === "local"; const isLocalServer = serverId === "local";