@@ -293,6 +293,7 @@ const generateNewTree = <
293293 // extremely complex but the first build is quite easy. During the following
294294 // idle callbacks the old tree will be shown.
295295 ! ( placeholder === null && ! state . order ) ;
296+
296297 const hasTime = useIdleCallback
297298 ? ( deadline : RequestIdleCallbackDeadline ) => deadline . timeRemaining ( ) > 0
298299 : ( ) => true ;
@@ -384,16 +385,6 @@ const generateNewTree = <
384385 : { order, records} ;
385386} ;
386387
387- const updateRecordVisibility = <
388- TData extends NodeData ,
389- TNodePublicState extends NodePublicState < TData >
390- > (
391- record : NodeRecord < TNodePublicState > ,
392- ) : void => {
393- const { parent} = record ;
394- record . isShown = parent ? parent . public . isOpen && parent . isShown : true ;
395- } ;
396-
397388const MAX_FUNCTION_ARGUMENTS = 32768 ;
398389
399390// If we need to perform only the update, treeWalker won't be used. Update will
@@ -480,7 +471,11 @@ const updateExistingTree = <
480471 // the order list yet. We should do it AFTER the visibility update
481472 // happens because otherwise we won't be able to distinguish if the
482473 // element should be included in the order list.
483- updateRecordVisibility ( record ) ;
474+
475+ // Update record visibility
476+ record . isShown = record . parent
477+ ? record . parent . public . isOpen && record . parent . isShown
478+ : true ;
484479
485480 if ( record . isShown ) {
486481 orderParts [ orderPartsCursor ] . push ( record . public . data . id ) ;
@@ -523,7 +518,10 @@ const updateExistingTree = <
523518 count += 1 ;
524519 }
525520
526- updateRecordVisibility ( record ) ;
521+ // Update record visibility
522+ record . isShown = record . parent
523+ ? record . parent . public . isOpen && record . parent . isShown
524+ : true ;
527525 } ;
528526
529527 apply = ( ) => {
0 commit comments