Search

Detail

  • layout.tsx
<DendronSearch {...props} />
  • components/DendronSearch.tsx

DebouncedDendronSearchComponent {

    debouncedSearch = debounce(..., SEARCH_DELAY)
    return DendronSearchComponent search=debouncedSearch
}

DendronSearchComponent(props) {
    search : = props

    value, search = useState(initValue)

    { noteBodies, requestNotes } = useNoteBodies();

    useEffect {
        search ? search(value, setSearchResults)
    }, [value, search]

    useEffect {
        requestNotes(searchResults)
    }, [searchResults]

    useEffect {
        value.startsWith "?" {
            setResults
        }
    }

    AutoComplete {
        results.map {
            AutoComplete {
                MatchBody {

                }
            }
        }
    }
}

MatchBody {
    
}

useNoteBodies {
    fetchNoteBodyWithId(id) {
        fetch /data/notes/${id}.md
    }
}

Fuse

  • location: utils/fuse.ts
useFuse {
    value = await provider
    if (value) {

    }
    
}