Skip to content

Commit

Permalink
disallow persistent log
Browse files Browse the repository at this point in the history
  • Loading branch information
sschiessl-bcp committed Apr 23, 2022
1 parent 46524ec commit 9c19369
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/AppInit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import {HashRouter, BrowserRouter} from "react-router-dom";

const Router = __HASH_HISTORY__ ? HashRouter : BrowserRouter;

// DEPRECATED / WARNING: this is deactivated because there is a race condition for some components when log is saved,
// since it calls setState. If the subcomponent does not have a tailored rerendering logic, this may a WSOD
const allowPersistentLog = false;

class RootIntl extends React.Component {
UNSAFE_componentWillMount() {
IntlActions.switchLocale(this.props.locale);
Expand Down Expand Up @@ -67,7 +71,11 @@ class AppInit extends React.Component {
* @param error
*/
componentDidCatch(error) {
this.saveExtendedLog("error", [error]);
if (this.persistentLogEnabled) {
this.saveExtendedLog("error", [error]);
} else {
console.error(error);
}
}

componentDidUpdate(nextProps, nextState) {
Expand Down Expand Up @@ -97,6 +105,7 @@ class AppInit extends React.Component {
}

_enablePersistingLog() {
if (!allowPersistentLog) return;
if (this.persistentLogEnabled) return;

if (!this.state.extendeLogText.length) {
Expand Down

0 comments on commit 9c19369

Please sign in to comment.