From 0eee10d2d326b8b45ca76086a68afccdff7eceeb Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sun, 3 Jan 2021 16:59:55 -0600 Subject: [PATCH] Further cleanup editor warning --- src/lib/tw-editor-warning-hoc.jsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/lib/tw-editor-warning-hoc.jsx b/src/lib/tw-editor-warning-hoc.jsx index 151a7bf3a..9a9e2863c 100644 --- a/src/lib/tw-editor-warning-hoc.jsx +++ b/src/lib/tw-editor-warning-hoc.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import {connect} from 'react-redux'; import {showStandardAlert} from '../reducers/alerts'; -let setup = false; +let shownWarning = false; const DIRTY_KEY = 'tw:dirty'; @@ -23,7 +23,7 @@ const TWEditorWarningHOC = function (WrappedComponent) { } }; - if (!setup) { + if (!shownWarning) { this.showWarningIfInEditor(); if (localStorage.getItem(DIRTY_KEY) === '1') { @@ -32,22 +32,19 @@ const TWEditorWarningHOC = function (WrappedComponent) { } } shouldComponentUpdate () { - return !setup; + return !shownWarning; } componentDidUpdate () { this.showWarningIfInEditor(); } showWarningIfInEditor () { if (!this.props.isPlayerOnly) { - setup = true; + shownWarning = true; - // If compiler is already disabled, don't show the warning or change warp timer. - if (this.props.compilerOptions.enabled) { - this.props.onShowWarning(); - this.props.vm.setCompilerOptions({ - warpTimer: true - }); - } + this.props.onShowWarning(); + this.props.vm.setCompilerOptions({ + warpTimer: true + }); } } render () {