Skip to content

pushToStdout function changes the state inplace #904

Description

@impulsgraw
pushToStdout = (message, options) => {
  const { stdout } = this.state

  if (this.props.locked) stdout.pop()

  stdout.push({ message, isEcho: options?.isEcho || false })

  /* istanbul ignore next: Covered by interactivity tests */
  if (options?.rawInput) this.pushToHistory(options.rawInput)
  this.setState({ stdout: stdout })
}

Here the state object is being changed inplace, so setState does nothing. Probably it's minor, since I couldn't observe the bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions