EAV Hooks
TanStack Query hooks for EAV record operations with automatic cache invalidation.
No entities found. Run the dev server with a schema to see the demo.
components/record-list.tsx
import { useEavRecords } from "@reopt-ai/brandapp-sdk/react/hooks";
import { where } from "@reopt-ai/brandapp-sdk/eav";
import type { ReoptSDK } from "@reopt-ai/brandapp-sdk";
function RecordList({ sdk, entityId }: { sdk: ReoptSDK; entityId: string }) {
const { data, isLoading, error, refetch } = useEavRecords(sdk, entityId, {
// Optional filters
filters: [where("status").eq("active")],
});
if (isLoading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return (
<ul>
{data?.records.map((record) => (
<li key={record.id}>
{String(record.values.name)}
</li>
))}
</ul>
);
}