feat: show the search box on every record view list
The backend searches its columns even though it marks every field is_search: false, so the box was never shown. Render it always and keep the field-name placeholder for views that do flag searchable fields. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
b8f50efaf0
commit
bd141e3585
@ -46,6 +46,8 @@ export default function RecordView({
|
|||||||
return () => clearTimeout(id)
|
return () => clearTimeout(id)
|
||||||
}, [term, query.search, setSearch])
|
}, [term, query.search, setSearch])
|
||||||
|
|
||||||
|
// Names the placeholder only: the backend searches its own columns whatever
|
||||||
|
// is_search says (it returns false on every field), so the box always shows.
|
||||||
// A rich column's fields stay searchable.
|
// A rich column's fields stay searchable.
|
||||||
const searchable = fields
|
const searchable = fields
|
||||||
.flatMap((f) => (f.data_type === 'rich' ? [...f.title, ...f.subtitle] : [f]))
|
.flatMap((f) => (f.data_type === 'rich' ? [...f.title, ...f.subtitle] : [f]))
|
||||||
@ -66,13 +68,15 @@ export default function RecordView({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Toolbar count={total} countLabel="records">
|
<Toolbar count={total} countLabel="records">
|
||||||
{searchable.length > 0 && (
|
<SearchInput
|
||||||
<SearchInput
|
value={term}
|
||||||
value={term}
|
onChange={setTerm}
|
||||||
onChange={setTerm}
|
placeholder={
|
||||||
placeholder={`Search by ${searchable.map((f) => displayLabel(f.output_label)).join(', ')}…`}
|
searchable.length > 0
|
||||||
/>
|
? `Search by ${searchable.map((f) => displayLabel(f.output_label)).join(', ')}…`
|
||||||
)}
|
: 'Search…'
|
||||||
|
}
|
||||||
|
/>
|
||||||
{toolbar}
|
{toolbar}
|
||||||
{loading && <span className="toolbar__count">Loading…</span>}
|
{loading && <span className="toolbar__count">Loading…</span>}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user