[Glitch] Remove unused bundle-related Redux actions

Port 07ecf648dd to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion
2025-11-27 11:50:48 +01:00
committed by Claire
parent 78feddec79
commit 51698213b5
6 changed files with 10 additions and 66 deletions

View File

@@ -2,7 +2,6 @@ import PropTypes from 'prop-types';
import { PureComponent } from 'react';
const emptyComponent = () => null;
const noop = () => { };
class Bundle extends PureComponent {
@@ -12,18 +11,12 @@ class Bundle extends PureComponent {
error: PropTypes.func,
children: PropTypes.func.isRequired,
renderDelay: PropTypes.number,
onFetch: PropTypes.func,
onFetchSuccess: PropTypes.func,
onFetchFail: PropTypes.func,
};
static defaultProps = {
loading: emptyComponent,
error: emptyComponent,
renderDelay: 0,
onFetch: noop,
onFetchSuccess: noop,
onFetchFail: noop,
};
static cache = new Map;
@@ -50,7 +43,7 @@ class Bundle extends PureComponent {
}
load = (props) => {
const { fetchComponent, onFetch, onFetchSuccess, onFetchFail, renderDelay } = props || this.props;
const { fetchComponent, renderDelay } = props || this.props;
const cachedMod = Bundle.cache.get(fetchComponent);
if (fetchComponent === undefined) {
@@ -58,11 +51,8 @@ class Bundle extends PureComponent {
return Promise.resolve();
}
onFetch();
if (cachedMod) {
this.setState({ mod: cachedMod.default });
onFetchSuccess();
return Promise.resolve();
}
@@ -77,11 +67,9 @@ class Bundle extends PureComponent {
.then((mod) => {
Bundle.cache.set(fetchComponent, mod);
this.setState({ mod: mod.default });
onFetchSuccess();
})
.catch((error) => {
this.setState({ mod: null });
onFetchFail(error);
});
};