The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
import { useEffect, useState } from 'react'
/**
* Returns `value`, but only after `ms` have passed with no further change.
*
* Built for price-quote keys (Review B4/B5, Runde 3/4, 20.09.2026): a field
* that changes on every keystroke (a typed prompt) must not restart a
* rate-limited network call every time, but the field still belongs in the
* key once it settles. Shared between useStudioPrice.ts (the Composer's live
* meter) and PresetWorkshop.tsx (the same shape, same fix, one function
* instead of two copies that could drift apart).
*/
export function useDebouncedValue<T>(value: T, ms: number): T {
const [debounced, setDebounced] = useState(value)
useEffect(() => {
const t = setTimeout(() => setDebounced(value), ms)
return () => clearTimeout(t)
}, [value, ms])
return debounced
}