admin: fix useSearch

This commit is contained in:
dswbx
2025-06-10 08:38:10 +02:00
parent 12c955155d
commit 88419548c7
4 changed files with 64 additions and 31 deletions

View File

@@ -35,8 +35,19 @@ export function DataEntityList({ params }) {
useBrowserTitle(["Data", entity?.label ?? params.entity]);
const [navigate] = useNavigate();
const search = useSearch(searchSchema, {
select: entity.getSelect(undefined, "table"),
sort: entity.getDefaultSort(),
defaultValue: {
select: entity.getSelect(undefined, "table"),
sort: entity.getDefaultSort(),
},
beforeEncode: (v) => {
if ("sort" in v && v.sort) {
return {
...v,
sort: `${v.sort.dir === "asc" ? "" : "-"}${v.sort.by}`,
};
}
return v;
},
});
const $q = useApiQuery(