@@ -4,8 +4,8 @@ import { ShredEvent } from "../../../api/entities";
44import { delayMs , xRangeMs } from "./const" ;
55import { nsPerMs , slotsPerLeader } from "../../../consts" ;
66import { getSlotGroupLeader } from "../../../utils" ;
7- import { startupFinalTurbineHeadAtom } from "../../StartupProgress/atoms" ;
87import { serverTimeMsAtom } from "../../../atoms" ;
8+ import { slotCaughtUpAtom } from "../../../api/atoms" ;
99
1010type ShredEventTsDeltaMs = number | undefined ;
1111/**
@@ -44,14 +44,14 @@ export function createLiveShredsAtoms() {
4444 } > ( ) ;
4545 const rangeAfterStartupAtom = atom ( ( get ) => {
4646 const range = get ( _slotRangeAtom ) ;
47- const startupFinalTurbineHead = get ( startupFinalTurbineHeadAtom ) ;
48- if ( ! range || startupFinalTurbineHead == null ) return ;
47+ const slotCaughtUp = get ( slotCaughtUpAtom ) ;
48+ if ( ! range || slotCaughtUp == null ) return ;
4949
50- // no slots after final turbine head
51- if ( startupFinalTurbineHead + 1 > range . max ) return ;
50+ // no slots after startup
51+ if ( slotCaughtUp + 1 > range . max ) return ;
5252
5353 return {
54- min : Math . max ( startupFinalTurbineHead + 1 , range . min ) ,
54+ min : Math . max ( slotCaughtUp + 1 , range . min ) ,
5555 max : range . max ,
5656 } ;
5757 } ) ;
@@ -62,16 +62,18 @@ export function createLiveShredsAtoms() {
6262 minCompletedSlot : atom ( ( get ) => get ( _minCompletedSlotAtom ) ) ,
6363 range : atom ( ( get ) => get ( _slotRangeAtom ) ) ,
6464 rangeAfterStartup : rangeAfterStartupAtom ,
65- // leader slots after turbine head at the end of startup
65+ /**
66+ * leader slots after startup, used for labels
67+ * */
6668 groupLeaderSlots : atom ( ( get ) => {
67- const range = get ( rangeAfterStartupAtom ) ;
68- const startupFinalTurbineHead = get ( startupFinalTurbineHeadAtom ) ;
69- if ( ! range || startupFinalTurbineHead == null ) return [ ] ;
70-
71- const min = Math . max ( startupFinalTurbineHead + 1 , range . min ) ;
72-
73- const slots = [ getSlotGroupLeader ( min ) ] ;
74- while ( slots [ slots . length - 1 ] + slotsPerLeader - 1 < range . max ) {
69+ const rangeAfterStartup = get ( rangeAfterStartupAtom ) ;
70+ if ( ! rangeAfterStartup ) return [ ] ;
71+
72+ const slots = [ getSlotGroupLeader ( rangeAfterStartup . min ) ] ;
73+ while (
74+ slots [ slots . length - 1 ] + slotsPerLeader - 1 <
75+ rangeAfterStartup . max
76+ ) {
7577 slots . push (
7678 getSlotGroupLeader ( slots [ slots . length - 1 ] + slotsPerLeader ) ,
7779 ) ;
0 commit comments