<commit_before>import React from 'react'
import { connect } from 'react-redux'
import styled from 'styled-components'

import { goBack } from '../activities/action-creators'

import IconButton from '../material/icon-button.jsx'

import BackIcon from '../icons/material/baseline-arrow_back-24px.svg'

const BackButton = styled(IconButton)`
  margin-right: 16px;
`

@connect(state => ({ activityOverlay: state.activityOverlay }))
export default class ActivityBackButton extends React.Component {
  render() {
    const { activityOverlay } = this.props

    if (activityOverlay.history.size < 2) return null

    return <BackButton icon={<BackIcon />} title='Back' onClick={this.onBackClick} />
  }
<commit_msg>Fix the back button disappearing when clicking off the map preferences overlay.<commit_after>import React from 'react'
import { connect } from 'react-redux'
import styled from 'styled-components'

import { goBack } from '../activities/action-creators'

import IconButton from '../material/icon-button.jsx'

import BackIcon from '../icons/material/baseline-arrow_back-24px.svg'

const BackButton = styled(IconButton)`
  margin-right: 16px;
`

@connect(state => ({ activityOverlay: state.activityOverlay }))
export default class ActivityBackButton extends React.Component {
  hasBeenRendered = false
  shouldShow = true

  render() {
    const { activityOverlay } = this.props

    // We only check to see if the back button should display on the first render, and keep it from
    // then on. This assumes that the back stack cannot change without the ActivityOverlay content
    // changing, which seems to be an accurate assumption. By doing it this way, we prevent the
    // back button from disappearing during transitions (e.g. if you click off the overlay)
    if (!this.hasBeenRendered) {
      this.shouldShow = activityOverlay.history.size >= 2
      this.hasBeenRendered = true
    }

    return this.shouldShow ? (
      <BackButton icon={<BackIcon />} title='Back' onClick={this.onBackClick} />
    ) : null
  }

{'fraction_non_alphanumeric': 0.10531496062992125, 'fraction_numerical': 0.004921259842519685, 'mean_word_length': 3.9585365853658536, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5000356', 'n_tokens_mistral': 576, 'n_tokens_neox': 565, 'n_words': 186}