@@ -55,7 +55,7 @@ export function SortableDataTable({
|
||||
});
|
||||
};
|
||||
return (
|
||||
<SortableContext value={{ order, onOrderChange }}>
|
||||
<SortableContext.Provider value={{ order, onOrderChange }}>
|
||||
<div className="space-y-4">
|
||||
<DataTable {...props} />
|
||||
{hasNext && loadNext && (
|
||||
@@ -70,7 +70,7 @@ export function SortableDataTable({
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</SortableContext>
|
||||
</SortableContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export function VendorsCell(props: Props) {
|
||||
organizationId: props.organizationId,
|
||||
}}
|
||||
items={(data) =>
|
||||
data.organization?.vendors?.edges.map((edge) => edge.node) ?? []
|
||||
data.organization?.vendors?.edges?.map((edge) => edge.node) ?? []
|
||||
}
|
||||
itemRenderer={({ item, onRemove }) => (
|
||||
<VendorBadge vendor={item} onRemove={onRemove} />
|
||||
|
||||
@@ -8,6 +8,7 @@ export function useStateWithSchema<T extends ZodTypeAny>(
|
||||
const [state, setState] = useState(initialValue);
|
||||
const [value, errors] = useMemo((): [z.infer<T>, Record<string, string>] => {
|
||||
try {
|
||||
schema.parse(state);
|
||||
return [schema.parse(state), {}];
|
||||
} catch (error) {
|
||||
if (error instanceof ZodError) {
|
||||
@@ -26,7 +27,7 @@ export function useStateWithSchema<T extends ZodTypeAny>(
|
||||
}, [state, schema]);
|
||||
|
||||
return {
|
||||
rawValue: value,
|
||||
rawValue: state,
|
||||
value,
|
||||
errors,
|
||||
update: useCallback(
|
||||
|
||||
@@ -233,7 +233,9 @@ export default function AssetsPage(props: Props) {
|
||||
<VendorsCell
|
||||
name="vendorIds"
|
||||
organizationId={organizationId}
|
||||
defaultValue={item?.vendors.edges.map((edge) => edge.node) ?? []}
|
||||
defaultValue={
|
||||
item?.vendors?.edges?.map((edge) => edge.node) ?? []
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user