Skip to content

Commit 8f6611f

Browse files
fix zero issue
1 parent 22ddec7 commit 8f6611f

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

explorer/src/App.tsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,16 @@ const Bar: React.FC<BarProps> = ({ viewData, currentTime, isMobile }) => {
574574

575575
if (status === "growing") {
576576
const elapsed = currentTime - startTime;
577-
growingLatencyText = `${Math.round(elapsed)}ms`;
577+
// Only show latency if it's positive
578+
if (elapsed > 1) {
579+
growingLatencyText = `${Math.round(elapsed)}ms`;
580+
}
578581
} else if (status === "notarized") {
579582
const latency = notarizationTime ? (notarizationTime - startTime) : 0;
580-
notarizedLatencyText = `${Math.round(latency)}ms`;
583+
// Only show latency if it's positive
584+
if (latency > 1) {
585+
notarizedLatencyText = `${Math.round(latency)}ms`;
586+
}
581587
// Format inBarText for block information
582588
if (block) {
583589
inBarText = isMobile ? `#${block.height}` : `#${block.height} | ${shortenUint8Array(block.digest)}`;
@@ -588,9 +594,14 @@ const Bar: React.FC<BarProps> = ({ viewData, currentTime, isMobile }) => {
588594
// Get total time (seed to finalization)
589595
const totalLatency = finalizationTime ? (finalizationTime - startTime) : 0;
590596

591-
// Set latency text
592-
notarizedLatencyText = `${Math.round(notarizeLatency)}ms`;
593-
finalizedLatencyText = `${Math.round(totalLatency)}ms`; // Show total time at finalization point
597+
// Set latency text only if values are positive
598+
if (notarizeLatency > 1) {
599+
notarizedLatencyText = `${Math.round(notarizeLatency)}ms`;
600+
}
601+
602+
if (totalLatency > 1) {
603+
finalizedLatencyText = `${Math.round(totalLatency)}ms`; // Show total time at finalization point
604+
}
594605

595606
// Set block info
596607
if (block) {
@@ -655,8 +666,8 @@ const Bar: React.FC<BarProps> = ({ viewData, currentTime, isMobile }) => {
655666
{/* Only show timing if not skipped */}
656667
{signature && (
657668
<>
658-
{/* Latency at notarization point */}
659-
{(status === "notarized" || status === "finalized") && notarizedWidth > 0 && (
669+
{/* Latency at notarization point - only show if text exists */}
670+
{(status === "notarized" || status === "finalized") && notarizedWidth > 0 && notarizedLatencyText && (
660671
<div
661672
className="latency-text notarized-latency"
662673
style={{
@@ -667,8 +678,8 @@ const Bar: React.FC<BarProps> = ({ viewData, currentTime, isMobile }) => {
667678
</div>
668679
)}
669680

670-
{/* Latency for growing bars - follows the tip */}
671-
{status === "growing" && (
681+
{/* Latency for growing bars - follows the tip - only show if text exists */}
682+
{status === "growing" && growingLatencyText && (
672683
<div
673684
className="latency-text growing-latency"
674685
style={{
@@ -679,8 +690,8 @@ const Bar: React.FC<BarProps> = ({ viewData, currentTime, isMobile }) => {
679690
</div>
680691
)}
681692

682-
{/* Total latency marker for finalized views */}
683-
{status === "finalized" && (
693+
{/* Total latency marker for finalized views - only show if text exists */}
694+
{status === "finalized" && finalizedLatencyText && (
684695
<div
685696
className="latency-text finalized-latency"
686697
style={{

0 commit comments

Comments
 (0)