React ApexCharts Line Chart Showing Incorrect Data in Production

I’m developing a React component that utilizes ApexCharts to display a line chart. The chart is supposed to display data for three series under the “Today” category. However, after deploying my application using Docker in a production environment, the chart displays data from all available series, not just the three expected ones. Strangely, this issue does not occur in my local development environment.

Version Details

  • react: “^18”,
  • react-apexcharts: “^1.4.1”
  • next: “14.1.3”

enter image description here

Expected Behavior: The chart should only display data for three series under the “Today” category.
Actual Behavior in Production: The chart displays data from all available series, which is incorrect.
Local Development: The chart works correctly in my local development environment.

import React, { useEffect, useState, useMemo, memo } from "react";
import moment from "moment";

const ReactApexChart = React.lazy(() => import("react-apexcharts"));

import { formatNumber, getCurrentHour, formationTimezone } from "@utils/helper";

const LineChart = ({
  labels,
  series,
  colors,
  height,
  multipleYaxis,
  noTick = false,
  isRevenue,
  selectedDate,
  isArticle,
}: any) => {
  let period_date = formationTimezone(moment(), "YYYY-MM-DD");
  const formattedDate = selectedDate
    ? moment(selectedDate).format("YYYY-MM-DD")
    : null;

    const updatedSeriesData = useMemo(() => {
      const getCurrentData = () => {
        const currentHour = getCurrentHour();
        const currentSeries = series?.find((item: any) => item.name === "Today");
        return currentSeries?.data?.slice(0, currentHour) || [];
      };
    
      if (!isArticle || period_date !== formattedDate) {
        return series;
      }
    
      const updatedSeriesData = series.map((data: any) => {
        if (data.name === "Today") {
          return {
            ...data,
            data: getCurrentData(),
          };
        }
        return data;
      });
    
      return updatedSeriesData;
    }, [series, isArticle, period_date, formattedDate]);
  
    console.log("updatedSeriesData", updatedSeriesData)

  return (
    <ReactApexChart
      options={{
        xaxis: {
          categories: labels,
          tickAmount: noTick ? labels?.length : labels?.length / 2,
          labels: {
            rotate: -0,
            formatter: function (value: any) {
              if (typeof value === "string") {
                const dateTimeParts = value?.split(" ");
                if (dateTimeParts?.length === 4) {
                  const timePart = `${dateTimeParts[2]} ${dateTimeParts[3]}`;
                  return timePart;
                }
              }
              return value;
            },
          },
          tooltip: {
            enabled: false,
          },
        },
        colors: colors,
        grid: {
          xaxis: {
            lines: {
              show: false,
            },
          },
          yaxis: {
            lines: {
              show: false,
            },
          },
        },
        tooltip: {
          x: {
            show: true,
            formatter: function (
              value: any,
              { series, seriesIndex, dataPointIndex }: any
            ) {
              const label = labels?.[dataPointIndex];
              return label;
            },
          },
          y: [
            {
              formatter: function (val: any) {
                const value = formatNumber(val);
                return isRevenue ? `$${value}` : value;
              },
            },
            {
              formatter: function (val: any) {
                const value = formatNumber(val);
                return isRevenue ? `$${value}` : value;
              },
            },
          ],
        },
        yaxis: multipleYaxis
          ? [
              {
                labels: {
                  formatter: function (value: any) {
                    if (value === 5e-324) {
                      return "0";
                    }
                    return formatNumber(value);
                  },
                },
              },
              {
                labels: {
                  formatter: function (value: any) {
                    if (value === 5e-324) {
                      return "0";
                    }
                    return formatNumber(value);
                  },
                },
                opposite: true,
                show: false,
              },
            ]
          : {
              labels: {
                formatter: function (value: any) {
                  return formatNumber(value);
                },
              },
            },
        dataLabels: {
          enabled: false,
        },
        chart: {
          height: 350,
          type: "line",
          zoom: {
            enabled: false,
          },
          toolbar: {
            show: false,
          },
        },
        legend: {
          show: true,
          showForSingleSeries: true,
        },
        stroke: {
          curve: "straight",
        },
      }}
      series={updatedSeriesData || []}
      type="line"
      width="100%"
      height={height || 200}
    />
  );
};

export default memo(LineChart);

sample series:

[
    {
        "name": "Today",
        "data": [
            1013,
            706,
            461
        ]
    },
    {
        "name": "Average",
        "data": [
            842,
            656,
            434,
            426,
            696,
            1303,
            2699,
            3673,
            4088,
            3795,
            3493,
            3407,
            3633,
            3489,
            3249,
            3148,
            3064,
            2581,
            2365,
            2547,
            2683,
            2792,
            2234
        ]
    }
]

I’m looking for insights into why the chart displays all available series in production despite my code specifying only three series under the “Today” category. Any suggestions on how to debug or fix this issue would be greatly appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật