Better loading detection

This commit is contained in:
Chi Vinh Le
2017-06-19 21:23:30 +07:00
parent e1bc1476ea
commit f954d2be90
@@ -108,17 +108,18 @@ export default class Moderation extends Component {
const activeTab = this.props.route.path === ':id' ? 'premod' : this.props.route.path;
const {asset} = root;
if (providedAssetId && !asset) {
if (asset === undefined) {
// Still loading.
return <Spinner />;
}
if (providedAssetId && asset === null) {
// Not found.
return <NotFoundAsset assetId={providedAssetId} />;
}
if (providedAssetId && (asset === undefined || asset.id !== providedAssetId)) {
// Still loading.
return <Spinner />;
}
const comments = root[activeTab];
let activeTabCount;
switch(activeTab) {