Fixed: Error refreshing page in Activity/Wanted

This commit is contained in:
ta264 2020-08-18 21:40:59 +01:00 committed by Qstick
parent 2639374243
commit ddef74edde
10 changed files with 65 additions and 21 deletions

View file

@ -113,6 +113,8 @@ class CutoffUnmet extends Component {
isPopulated,
error,
items,
isArtistFetching,
isArtistPopulated,
selectedFilterKey,
filters,
columns,
@ -130,6 +132,9 @@ class CutoffUnmet extends Component {
isConfirmSearchAllCutoffUnmetModalOpen
} = this.state;
const isAllPopulated = isPopulated && isArtistPopulated;
const isAnyFetching = isFetching || isArtistFetching;
const itemsSelected = !!this.getSelectedIds().length;
const isShowingMonitored = getMonitoredValue(this.props);
@ -178,26 +183,26 @@ class CutoffUnmet extends Component {
<PageContentBody>
{
isFetching && !isPopulated &&
isAnyFetching && !isAllPopulated &&
<LoadingIndicator />
}
{
!isFetching && error &&
!isAnyFetching && error &&
<div>
Error fetching cutoff unmet
</div>
}
{
isPopulated && !error && !items.length &&
isAllPopulated && !error && !items.length &&
<div>
No cutoff unmet items
</div>
}
{
isPopulated && !error && !!items.length &&
isAllPopulated && !error && !!items.length &&
<div>
<Table
columns={columns}
@ -261,6 +266,8 @@ CutoffUnmet.propTypes = {
isPopulated: PropTypes.bool.isRequired,
error: PropTypes.object,
items: PropTypes.arrayOf(PropTypes.object).isRequired,
isArtistFetching: PropTypes.bool.isRequired,
isArtistPopulated: PropTypes.bool.isRequired,
selectedFilterKey: PropTypes.string.isRequired,
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
columns: PropTypes.arrayOf(PropTypes.object).isRequired,

View file

@ -17,10 +17,13 @@ import CutoffUnmet from './CutoffUnmet';
function createMapStateToProps() {
return createSelector(
(state) => state.wanted.cutoffUnmet,
(state) => state.artist,
createCommandExecutingSelector(commandNames.CUTOFF_UNMET_ALBUM_SEARCH),
(cutoffUnmet, isSearchingForCutoffUnmetAlbums) => {
(cutoffUnmet, artist, isSearchingForCutoffUnmetAlbums) => {
return {
isArtistFetching: artist.isFetching,
isArtistPopulated: artist.isPopulated,
isSearchingForCutoffUnmetAlbums,
isSaving: cutoffUnmet.items.filter((m) => m.isSaving).length > 1,
...cutoffUnmet

View file

@ -122,6 +122,8 @@ class Missing extends Component {
isPopulated,
error,
items,
isArtistFetching,
isArtistPopulated,
selectedFilterKey,
filters,
columns,
@ -140,6 +142,9 @@ class Missing extends Component {
isInteractiveImportModalOpen
} = this.state;
const isAllPopulated = isPopulated && isArtistPopulated;
const isAnyFetching = isFetching || isArtistFetching;
const itemsSelected = !!this.getSelectedIds().length;
const isShowingMonitored = getMonitoredValue(this.props);
@ -195,26 +200,26 @@ class Missing extends Component {
<PageContentBody>
{
isFetching && !isPopulated &&
isAnyFetching && !isAllPopulated &&
<LoadingIndicator />
}
{
!isFetching && error &&
!isAnyFetching && error &&
<div>
Error fetching missing items
</div>
}
{
isPopulated && !error && !items.length &&
isAllPopulated && !error && !items.length &&
<div>
No missing items
</div>
}
{
isPopulated && !error && !!items.length &&
isAllPopulated && !error && !!items.length &&
<div>
<Table
columns={columns}
@ -284,6 +289,8 @@ Missing.propTypes = {
isPopulated: PropTypes.bool.isRequired,
error: PropTypes.object,
items: PropTypes.arrayOf(PropTypes.object).isRequired,
isArtistFetching: PropTypes.bool.isRequired,
isArtistPopulated: PropTypes.bool.isRequired,
selectedFilterKey: PropTypes.string.isRequired,
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
columns: PropTypes.arrayOf(PropTypes.object).isRequired,

View file

@ -16,10 +16,13 @@ import Missing from './Missing';
function createMapStateToProps() {
return createSelector(
(state) => state.wanted.missing,
(state) => state.artist,
createCommandExecutingSelector(commandNames.MISSING_ALBUM_SEARCH),
(missing, isSearchingForMissingAlbums) => {
(missing, artist, isSearchingForMissingAlbums) => {
return {
isArtistFetching: artist.isFetching,
isArtistPopulated: artist.isPopulated,
isSearchingForMissingAlbums,
isSaving: missing.items.filter((m) => m.isSaving).length > 1,
...missing