⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
'use client';
import { useState } from 'react';
import { useDebouncedValue } from '@/hooks/useDebouncedValue';
// A shorter term matches most of a list, so the list stays unfiltered until the reader
// has typed enough for the result to mean something.
const MIN_LENGTH = 3;
// The search behind a server-filtered list: `search` is what the input shows, `term` is
// what the query sends once typing has paused and the term narrows anything.
export function useSearchTerm() {
const [search, setSearch] = useState('');
const debounced = useDebouncedValue(search.trim(), 300);
return { search, setSearch, term: debounced.length >= MIN_LENGTH ? debounced : undefined };
}