File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -581,13 +581,16 @@ export default function GeometricExplorer() {
581581 setFeedingStats ( { count : bestSet . size , balance : stats , phases : stats . phases } ) ;
582582
583583 // 3. Filter visualization if cycling
584- if ( isCycling && currentPhaseIdx >= 0 && stats . phases . length > 0 ) {
585- const phase = stats . phases [ currentPhaseIdx ] ;
584+ const hasPhases = Array . isArray ( stats . phases ) && stats . phases . length > 0 ;
585+ const phaseIdx = hasPhases && currentPhaseIdx >= 0 ? currentPhaseIdx % stats . phases . length : - 1 ;
586+ const activePhase = hasPhases && phaseIdx >= 0 ? stats . phases [ phaseIdx ] : null ;
587+
588+ if ( activePhase ) {
586589 // Show only the pair
587- pointsToShow . add ( phase . pair [ 0 ] ) ;
588- pointsToShow . add ( phase . pair [ 1 ] ) ;
590+ pointsToShow . add ( activePhase . pair [ 0 ] ) ;
591+ pointsToShow . add ( activePhase . pair [ 1 ] ) ;
589592 // Show only the loops driven by this pair
590- loopsToShow = activeLoopsList . filter ( ( _ , idx ) => phase . loops . includes ( idx ) ) ;
593+ loopsToShow = activeLoopsList . filter ( ( _ , idx ) => activePhase . loops . includes ( idx ) ) ;
591594 } else {
592595 // Show all
593596 pointsToShow = bestSet ;
You can’t perform that action at this time.
0 commit comments