mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 01:45:53 +00:00
perf(DndContext): ignore some context when UI is not designable
This commit is contained in:
parent
a7e086ccad
commit
e1e8f54d03
@ -77,6 +77,7 @@ const useDragEnd = (onDragEnd) => {
|
||||
export type DndContextProps = Props;
|
||||
|
||||
export const DndContext = (props: Props) => {
|
||||
const { designable } = useDesignable();
|
||||
const { t } = useTranslation();
|
||||
const [visible, setVisible] = useState(true);
|
||||
|
||||
@ -94,6 +95,10 @@ export const DndContext = (props: Props) => {
|
||||
|
||||
const onDragEnd = useDragEnd(props?.onDragEnd);
|
||||
|
||||
if (!designable) {
|
||||
return <>{props.children}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<DndKitContext collisionDetection={rectIntersection} {...props} onDragStart={onDragStart} onDragEnd={onDragEnd}>
|
||||
<DragOverlay
|
||||
|
Loading…
Reference in New Issue
Block a user