@@ -124,7 +124,7 @@ const DropZoneChild = ({
124
124
125
125
const contentItem = useAppStore (
126
126
useShallow ( ( s ) => {
127
- return s . state . indexes . nodes [ componentId ] ?. data ;
127
+ return s . state . indexes . nodes [ componentId ] ?. flatData ;
128
128
} )
129
129
) ;
130
130
@@ -275,31 +275,36 @@ const DropZoneEdit = forwardRef<HTMLDivElement, DropZoneProps>(
275
275
return {
276
276
isDeepestZone : s . zoneDepthIndex [ zoneCompound ] ?? false ,
277
277
inNextDeepestArea : s . nextAreaDepthIndex [ areaId || "" ] ,
278
- draggedItemId : s . draggedItem ?. id ,
279
278
draggedComponentType : s . draggedItem ?. data . componentType ,
280
279
userIsDragging : ! ! s . draggedItem ,
281
280
} ;
282
281
} ) ;
283
282
284
- // Register and unregister zone on mount
285
- // TODO cause re-render
286
- // useEffect(() => {
287
- // if (ctx?.registerZone) {
288
- // ctx?.registerZone(zoneCompound);
289
- // }
290
-
291
- // return () => {
292
- // if (ctx?.unregisterZone) {
293
- // ctx?.unregisterZone(zoneCompound);
294
- // }
295
- // };
296
- // }, []);
297
-
298
283
const zoneContentIds = useAppStore (
299
284
useShallow ( ( s ) => {
300
285
return s . state . indexes . zones [ zoneCompound ] ?. contentIds ;
301
286
} )
302
287
) ;
288
+ const zoneType = useAppStore (
289
+ useShallow ( ( s ) => {
290
+ return s . state . indexes . zones [ zoneCompound ] ?. type ;
291
+ } )
292
+ ) ;
293
+
294
+ // Register and unregister zone on mount
295
+ useEffect ( ( ) => {
296
+ if ( ! zoneType || zoneType === "dropzone" ) {
297
+ if ( ctx ?. registerZone ) {
298
+ ctx ?. registerZone ( zoneCompound ) ;
299
+ }
300
+
301
+ return ( ) => {
302
+ if ( ctx ?. unregisterZone ) {
303
+ ctx ?. unregisterZone ( zoneCompound ) ;
304
+ }
305
+ } ;
306
+ }
307
+ } , [ zoneType ] ) ;
303
308
304
309
const contentIds = useMemo ( ( ) => {
305
310
return zoneContentIds || [ ] ;
0 commit comments