@@ -284,59 +284,28 @@ const DrawerPopup: React.ForwardRefRenderFunction<
284284 break ;
285285 }
286286 }
287- // Track if props changed to detect controlled mode
288- const prevSizeRef = React . useRef < {
289- width ?: number | string ;
290- height ?: number | string ;
291- } > ( { } ) ;
292- const isControlledMode = React . useMemo ( ( ) => {
293- // Consider controlled if width/height changes between renders (external updates)
294- const currentSize = isHorizontal ? width : height ;
295- const prevSize = isHorizontal
296- ? prevSizeRef . current . width
297- : prevSizeRef . current . height ;
298-
299- const hasExternalUpdate =
300- currentSize !== undefined &&
301- currentSize !== prevSize &&
302- prevSize !== undefined ;
303-
304- // Update ref for next comparison
305- prevSizeRef . current = { width, height } ;
306-
307- return hasExternalUpdate ;
308- } , [ width , height , isHorizontal ] ) ;
309-
310- // Size calculation with controlled mode consideration
287+
288+ const isControlled = isHorizontal
289+ ? width !== undefined
290+ : height !== undefined ;
291+
311292 if ( isHorizontal ) {
312293 let finalWidth : number | string ;
313- if ( isControlledMode ) {
314- // In controlled mode, prioritize external width
315- finalWidth = width !== undefined ? width : defaultWidth ;
294+ if ( isControlled ) {
295+ finalWidth = width ! ;
316296 } else if ( currentSize !== undefined ) {
317- // In uncontrolled mode, user dragged size takes precedence
318297 finalWidth = currentSize ;
319- } else if ( width !== undefined ) {
320- // Fallback to provided width
321- finalWidth = width ;
322298 } else {
323- // Final fallback to default
324299 finalWidth = defaultWidth ;
325300 }
326301 wrapperStyle . width = parseWidthHeight ( finalWidth ) ;
327302 } else {
328303 let finalHeight : number | string ;
329- if ( isControlledMode ) {
330- // In controlled mode, prioritize external height
331- finalHeight = height !== undefined ? height : defaultHeight ;
304+ if ( isControlled ) {
305+ finalHeight = height ! ;
332306 } else if ( currentSize !== undefined ) {
333- // In uncontrolled mode, user dragged size takes precedence
334307 finalHeight = currentSize ;
335- } else if ( height !== undefined ) {
336- // Fallback to provided height
337- finalHeight = height ;
338308 } else {
339- // Final fallback to default
340309 finalHeight = defaultHeight ;
341310 }
342311 wrapperStyle . height = parseWidthHeight ( finalHeight ) ;
@@ -388,12 +357,12 @@ const DrawerPopup: React.ForwardRefRenderFunction<
388357 const handleResize = React . useCallback (
389358 ( size : number ) => {
390359 // In controlled mode, only trigger callback without updating internal state
391- if ( ! isControlledMode ) {
360+ if ( ! isControlled ) {
392361 setCurrentSize ( size ) ;
393362 }
394363 resizable ?. onResize ?.( size ) ;
395364 } ,
396- [ resizable , isControlledMode ] ,
365+ [ resizable , isControlled ] ,
397366 ) ;
398367
399368 const handleResizeStart = React . useCallback ( ( ) => {
0 commit comments