Home / File/ repro-invalid-destructuring-reassignment-undefined-variable.js — react Source File

repro-invalid-destructuring-reassignment-undefined-variable.js — react Source File

Architecture documentation for repro-invalid-destructuring-reassignment-undefined-variable.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

// @flow @compilationMode:"infer"
'use strict';

function getWeekendDays(user) {
  return [0, 6];
}

function getConfig(weekendDays) {
  return [1, 5];
}

component Calendar(user, defaultFirstDay, currentDate, view) {
  const weekendDays = getWeekendDays(user);
  let firstDay = defaultFirstDay;
  let daysToDisplay = 7;
  if (view === 'week') {
    let lastDay;
    // this assignment produces invalid code
    [firstDay, lastDay] = getConfig(weekendDays);
    daysToDisplay = ((7 + lastDay - firstDay) % 7) + 1;
  } else if (view === 'day') {
    firstDay = currentDate.getDayOfWeek();
    daysToDisplay = 1;
  }

  return [currentDate, firstDay, daysToDisplay];
}

export const FIXTURE_ENTRYPOINT = {
  fn: Calendar,
  params: [
    {
      user: {},
      defaultFirstDay: 1,
      currentDate: {getDayOfWeek: () => 3},
      view: 'week',
    },
  ],
  sequentialRenders: [
    {
      user: {},
      defaultFirstDay: 1,
      currentDate: {getDayOfWeek: () => 3},
      view: 'week',
    },
    {
      user: {},
      defaultFirstDay: 1,
      currentDate: {getDayOfWeek: () => 3},
      view: 'day',
    },
  ],
};

Subdomains

Frequently Asked Questions

What does repro-invalid-destructuring-reassignment-undefined-variable.js do?
repro-invalid-destructuring-reassignment-undefined-variable.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in repro-invalid-destructuring-reassignment-undefined-variable.js?
repro-invalid-destructuring-reassignment-undefined-variable.js defines 2 function(s): getConfig, getWeekendDays.
Where is repro-invalid-destructuring-reassignment-undefined-variable.js in the architecture?
repro-invalid-destructuring-reassignment-undefined-variable.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-invalid-destructuring-reassignment-undefined-variable.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free