@@ -5,8 +5,8 @@ import type {DragOverEvent} from 'react-grid-layout';
55import type { PluginRef , PluginWidgetProps , ReactGridLayoutProps } from 'src/typings' ;
66
77import { COMPACT_TYPE_HORIZONTAL_NOWRAP , DEFAULT_GROUP , TEMPORARY_ITEM_ID } from '../../constants' ;
8- import { DashKitContext } from '../../context' ;
98import type { DashKitCtxShape } from '../../context' ;
9+ import { DashKitContext } from '../../context' ;
1010import type { ConfigItem , ConfigLayout , DraggedOverItem } from '../../shared' ;
1111import { resolveLayoutGroup } from '../../utils' ;
1212import GridItem from '../GridItem/GridItem' ;
@@ -205,9 +205,7 @@ export default class GridLayout extends React.PureComponent<GridLayoutProps, Gri
205205 renderLayout : ConfigLayout [ ] ,
206206 nextProperties : Partial < ReactGridLayoutProps > ,
207207 ) => {
208- // Return a stable properties reference when values are shallowly equal.
209- // This prevents useMemo inside GroupLayout from invalidating on every render
210- // when groupGridProperties() returns a structurally identical but new object.
208+ // Return stable ref to prevent useMemo invalidation when properties are shallowly equal.
211209 const prevProperties = this . _memoGroupsProps [ group ] ;
212210 const keysNext = Object . keys ( nextProperties ) as Array < keyof ReactGridLayoutProps > ;
213211 const stableProperties =
@@ -369,8 +367,7 @@ export default class GridLayout extends React.PureComponent<GridLayoutProps, Gri
369367 cursorPosition : { offsetX, offsetY} ,
370368 } ;
371369
372- // Update imperatively so DragOverLayout can read cursor offset without
373- // a React prop change (and thus without re-rendering non-source groups).
370+ // Update imperatively so DragOverLayout reads fresh cursor offset without re-render.
374371 this . _sharedDragPositionRef . current = { offsetX, offsetY} ;
375372 }
376373
@@ -804,10 +801,7 @@ export default class GridLayout extends React.PureComponent<GridLayoutProps, Gri
804801 ? currentDraggingElement . item . id
805802 : null ;
806803
807- // Scope drag props to the source group only.
808- // Non-source groups receive stable false/null values so their React.memo
809- // comparator does not see a change on these three props — only hasSharedDragItem
810- // can still trigger their re-render (required for cross-group drop readiness).
804+ // Non-source groups get stable false/null — memo skips re-render on drag move.
811805 const isSourceGroup = Boolean ( currentDraggingElement ?. group === group ) ;
812806 const groupIsAnyDragging = isDragging && isSourceGroup ;
813807 const groupCurrentDraggingItemId = isSourceGroup ? currentDraggingItemId : null ;
0 commit comments