Skip to content

Commit d311c1a

Browse files
committed
fix
1 parent 1816b5c commit d311c1a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

webapp/src/App.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)