import type { LoaderFunction } from "remix" ; import { json } from "remix" ; import { searchLangs } from "~/models/langs" ; /**
 * This route is called via `useFetcher` from the Combobox input. It returns a
 * set of languages as the user types. It's called a Resource Route because it
 * doesn't export a component.  You might think of it as an "API Route".
 */ export const loader = async ( { request } ) => { const url = new URL ( request . url ) ; const query = url . searchParams . get ( "q" ) ; const langs = ( await searchLangs ( query || "" ) ) . slice ( 0 , 20 ) ; return json ( langs , { headers : { "Cache-Control" : "max-age=60" } } ) ; } ; /**
 * You shouldn't have to export this, we have a bug.
 * TODO: add github issue link (or just fix it)
 */ export default function Bug ( ) { return null ; }