Skip to content

Commit f95cd93

Browse files
committed
Fix initial historical load
1 parent 520d0d9 commit f95cd93

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

components/PriceComparisonChart.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ export default function PriceComparisonChart() {
611611
let newChainlinkPoints: any[] = [];
612612

613613
if (lastData) {
614-
// Find points that weren't in the last dataset
614+
// Find points that weren't in the last dataset (only animate truly NEW data)
615615
newRedstonePoints = processedRedstoneData.filter(
616616
(newPoint) =>
617617
!lastData.redstone.some(
@@ -627,18 +627,24 @@ export default function PriceComparisonChart() {
627627
)
628628
);
629629
} else {
630-
// First load - show all data immediately or add to buffer based on animation settings
631-
if (animationState.speed === "off") {
632-
setDisplayedRedstoneData(processedRedstoneData);
633-
setDisplayedChainlinkData(processedChainlinkData);
634-
} else {
635-
newRedstonePoints = processedRedstoneData;
636-
newChainlinkPoints = processedChainlinkData;
637-
}
630+
// First load - show ALL historical data immediately, no animation
631+
console.log(
632+
"Initial load: showing",
633+
processedRedstoneData.length,
634+
"historical points immediately"
635+
);
636+
setDisplayedRedstoneData(processedRedstoneData);
637+
setDisplayedChainlinkData(processedChainlinkData);
638+
// Don't add historical data to animation buffer - only future updates will be animated
638639
}
639640

640-
// Add new points to animation buffer
641+
// Add only NEW points to animation buffer (not historical data)
641642
if (newRedstonePoints.length > 0 || newChainlinkPoints.length > 0) {
643+
console.log(
644+
"Adding",
645+
newRedstonePoints.length,
646+
"new points to animation buffer"
647+
);
642648
setPendingDataBuffer((prev) => ({
643649
redstone: [...prev.redstone, ...newRedstonePoints],
644650
chainlink: [...prev.chainlink, ...newChainlinkPoints],

0 commit comments

Comments
 (0)