Skip to content

TypeError: reduce of empty array with no initial value on https://changes.moz.tools/team.html?teams=Privacy+Engineering+-+WebCompat #4588

Open
@marco-c

Description

@marco-c

The error occurs on:

export async function renderTestFailureStatsChart(chartEl) {
  const componentsToDaysToStats = await componentTestStats;

  const components = getOption("components");

  const allTestStatsDays = [].concat
    .apply(
      [],
      Object.entries(componentsToDaysToStats)
        .filter(([component, daysToStats]) => components.includes(component))
        .map(([_, daysToStats]) => Object.entries(daysToStats))
    )
    .filter((testStatsDay) => "bugs" in testStatsDay[1]);

  const minDate = getPlainDate(
    allTestStatsDays.reduce((minTestStatsDay, testStatsDay) =>
      Temporal.PlainDate.compare(
        getPlainDate(testStatsDay[0]),
        getPlainDate(minTestStatsDay[0])
      ) < 0
        ? testStatsDay
        : minTestStatsDay
    )[0]
  );

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingui

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions