MCPcopy
hub / github.com/epicweb-dev/epic-stack / CacheAdminRoute

Function CacheAdminRoute

app/routes/admin+/cache.tsx:93–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91}
92
93export default function CacheAdminRoute() {
94 const data = useLoaderData<typeof loader>()
95 const [searchParams] = useSearchParams()
96 const submit = useSubmit()
97 const query = searchParams.get('query') ?? ''
98 const limit = searchParams.get('limit') ?? '100'
99 const instance = searchParams.get('instance') ?? data.instance
100
101 const handleFormChange = useDebounce((form: HTMLFormElement) => {
102 submit(form)
103 }, 400)
104
105 return (
106 <div className="container">
107 <h1 className="text-h1">Cache Admin</h1>
108 <Spacer size="2xs" />
109 <Form
110 method="get"
111 className="flex flex-col gap-4"
112 onChange={(e) => handleFormChange(e.currentTarget)}
113 >
114 <div className="flex-1">
115 <div className="flex flex-1 gap-4">
116 <button
117 type="submit"
118 className="flex h-16 items-center justify-center"
119 >
120 🔎
121 </button>
122 <Field
123 className="flex-1"
124 labelProps={{ children: 'Search' }}
125 inputProps={{
126 type: 'search',
127 name: 'query',
128 defaultValue: query,
129 }}
130 />
131 <div className="flex h-16 w-14 items-center text-lg font-medium text-muted-foreground">
132 <span title="Total results shown">
133 {data.cacheKeys.sqlite.length + data.cacheKeys.lru.length}
134 </span>
135 </div>
136 </div>
137 </div>
138 <div className="flex flex-wrap items-center gap-4">
139 <Field
140 labelProps={{
141 children: 'Limit',
142 }}
143 inputProps={{
144 name: 'limit',
145 defaultValue: limit,
146 type: 'number',
147 step: '1',
148 min: '1',
149 max: '10000',
150 placeholder: 'results limit',

Callers

nothing calls this directly

Calls 1

useDebounceFunction · 0.90

Tested by

no test coverage detected