useCreateRecord
Create a new record
Create a new record
Signature
<TValues extends Record<string, unknown> = Record<string, unknown>>(objectName: string, options?: UseCreateRecordOptions<TValues> | undefined): UseMutationResult<ObjectRecord<TValues>, Error, CreateRecordMutationInput<...>>Examples
```tsx
const { mutate: createProduct, isPending } = useCreateRecord("products");
// Create a complete product
createProduct({
data: { name: "Nike Air Max", price: 129.99, status: "active" }
});
// Create a draft product (allows missing required fields)
createProduct({
data: { name: "Draft Product" },
options: { allowDraft: true }
});
// Or use hook-level default
const { mutate } = useCreateRecord("products", { allowDraft: true });
mutate({ data: { name: "Draft" } }); // allowDraft from hook optionsuseBulkDeleteRecords
Delete multiple records at once (soft delete — moves them to the trash). The collection stamp is the single optimistic mechanism: `deletedAt` is stamped on every targeted entity synchronously in `onMutate`. On partial failure only the failed ids are reverted (`deletedAt: null`); on full error every stamp is reverted. The archived/grid RQ caches refresh by invalidation on success — no cache surgery, no RQ snapshots.
useDeleteRecord
Delete a record (soft delete — moves it to the trash). The collection transaction is the single optimistic mechanism: `deletedAt` is stamped on the entity synchronously and auto-rolled back if the server rejects. The archived/detail RQ caches refresh by invalidation on success — no cache surgery, no snapshot.