fix: move useSensors hook to component top level (React hooks rules)
This commit is contained in:
@@ -170,6 +170,11 @@ export default function OfferDetail() {
|
||||
const alert = useAlert()
|
||||
const { hasPermission } = useAuth()
|
||||
const navigate = useNavigate()
|
||||
const dndSensors = useSensors(
|
||||
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
||||
useSensor(TouchSensor, { activationConstraint: { delay: 200, tolerance: 5 } }),
|
||||
useSensor(KeyboardSensor),
|
||||
)
|
||||
|
||||
const [loading, setLoading] = useState(isEdit)
|
||||
const [saving, setSaving] = useState(false)
|
||||
@@ -827,11 +832,7 @@ export default function OfferDetail() {
|
||||
|
||||
<div className="admin-table-responsive">
|
||||
<DndContext
|
||||
sensors={useSensors(
|
||||
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
||||
useSensor(TouchSensor, { activationConstraint: { delay: 200, tolerance: 5 } }),
|
||||
useSensor(KeyboardSensor),
|
||||
)}
|
||||
sensors={dndSensors}
|
||||
collisionDetection={closestCenter}
|
||||
modifiers={[restrictToVerticalAxis]}
|
||||
onDragEnd={(event: DragEndEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user