From 28d6c93b39491a1a2ddebfaf2aeaa01b5ff2c474 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 16 Nov 2021 17:07:30 +0000 Subject: [PATCH] Revert "Merge branch 'react-17-deprecated' into 'develop'" This reverts merge request !871 --- app/soapbox/features/ui/components/bundle.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/soapbox/features/ui/components/bundle.js b/app/soapbox/features/ui/components/bundle.js index b70ad342c..7089597b6 100644 --- a/app/soapbox/features/ui/components/bundle.js +++ b/app/soapbox/features/ui/components/bundle.js @@ -26,7 +26,7 @@ class Bundle extends React.PureComponent { onFetchFail: noop, } - static cache = new Map() + static cache = new Map state = { mod: undefined, @@ -34,12 +34,12 @@ class Bundle extends React.PureComponent { } componentDidMount() { - this.load(); + this.load(this.props); } - componentDidUpdate(prevProps) { - if (this.props.fetchComponent !== prevProps.fetchComponent) { - this.load(); + componentWillReceiveProps(nextProps) { + if (nextProps.fetchComponent !== this.props.fetchComponent) { + this.load(nextProps); } } @@ -49,8 +49,8 @@ class Bundle extends React.PureComponent { } } - load = () => { - const { fetchComponent, onFetch, onFetchSuccess, onFetchFail, renderDelay } = this.props; + load = (props) => { + const { fetchComponent, onFetch, onFetchSuccess, onFetchFail, renderDelay } = props || this.props; const cachedMod = Bundle.cache.get(fetchComponent); if (fetchComponent === undefined) {