1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: RootFolders may not load when adding collections

Fixes #5753
This commit is contained in:
Qstick 2021-02-01 23:20:30 -05:00
parent 6e46720d7b
commit aa95781d5d
6 changed files with 29 additions and 43 deletions

View File

@ -151,7 +151,8 @@ RootFolderSelectInputConnector.propTypes = {
}; };
RootFolderSelectInputConnector.defaultProps = { RootFolderSelectInputConnector.defaultProps = {
includeNoChange: false includeNoChange: false,
value: ''
}; };
export default connect(createMapStateToProps, createMapDispatchToProps)(RootFolderSelectInputConnector); export default connect(createMapStateToProps, createMapDispatchToProps)(RootFolderSelectInputConnector);

View File

@ -1,9 +1,7 @@
import _ from 'lodash'; import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
import MovieCreditPosters from '../MovieCreditPosters'; import MovieCreditPosters from '../MovieCreditPosters';
import MovieCastPoster from './MovieCastPoster'; import MovieCastPoster from './MovieCastPoster';
@ -26,19 +24,8 @@ function createMapStateToProps() {
); );
} }
const mapDispatchToProps = {
fetchRootFolders
};
class MovieCastPostersConnector extends Component { class MovieCastPostersConnector extends Component {
//
// Lifecycle
componentDidMount() {
this.props.fetchRootFolders();
}
// //
// Render // Render
@ -53,8 +40,4 @@ class MovieCastPostersConnector extends Component {
} }
} }
MovieCastPostersConnector.propTypes = { export default connect(createMapStateToProps)(MovieCastPostersConnector);
fetchRootFolders: PropTypes.func.isRequired
};
export default connect(createMapStateToProps, mapDispatchToProps)(MovieCastPostersConnector);

View File

@ -1,9 +1,7 @@
import _ from 'lodash'; import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
import MovieCreditPosters from '../MovieCreditPosters'; import MovieCreditPosters from '../MovieCreditPosters';
import MovieCrewPoster from './MovieCrewPoster'; import MovieCrewPoster from './MovieCrewPoster';
@ -26,19 +24,8 @@ function createMapStateToProps() {
); );
} }
const mapDispatchToProps = {
fetchRootFolders
};
class MovieCrewPostersConnector extends Component { class MovieCrewPostersConnector extends Component {
//
// Lifecycle
componentDidMount() {
this.props.fetchRootFolders();
}
// //
// Render // Render
@ -53,8 +40,4 @@ class MovieCrewPostersConnector extends Component {
} }
} }
MovieCrewPostersConnector.propTypes = { export default connect(createMapStateToProps)(MovieCrewPostersConnector);
fetchRootFolders: PropTypes.func.isRequired
};
export default connect(createMapStateToProps, mapDispatchToProps)(MovieCrewPostersConnector);

View File

@ -8,6 +8,7 @@ import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import NotFound from 'Components/NotFound'; import NotFound from 'Components/NotFound';
import PageContent from 'Components/Page/PageContent'; import PageContent from 'Components/Page/PageContent';
import PageContentBody from 'Components/Page/PageContentBody'; import PageContentBody from 'Components/Page/PageContentBody';
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
import getErrorMessage from 'Utilities/Object/getErrorMessage'; import getErrorMessage from 'Utilities/Object/getErrorMessage';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import MovieDetailsConnector from './MovieDetailsConnector'; import MovieDetailsConnector from './MovieDetailsConnector';
@ -46,7 +47,8 @@ function createMapStateToProps() {
} }
const mapDispatchToProps = { const mapDispatchToProps = {
push push,
fetchRootFolders
}; };
class MovieDetailsPageConnector extends Component { class MovieDetailsPageConnector extends Component {
@ -54,6 +56,10 @@ class MovieDetailsPageConnector extends Component {
// //
// Lifecycle // Lifecycle
componentDidMount() {
this.props.fetchRootFolders();
}
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (!this.props.titleSlug) { if (!this.props.titleSlug) {
this.props.push(`${window.Radarr.urlBase}/`); this.props.push(`${window.Radarr.urlBase}/`);
@ -112,7 +118,8 @@ MovieDetailsPageConnector.propTypes = {
isPopulated: PropTypes.bool.isRequired, isPopulated: PropTypes.bool.isRequired,
error: PropTypes.object, error: PropTypes.object,
match: PropTypes.shape({ params: PropTypes.shape({ titleSlug: PropTypes.string.isRequired }).isRequired }).isRequired, match: PropTypes.shape({ params: PropTypes.shape({ titleSlug: PropTypes.string.isRequired }).isRequired }).isRequired,
push: PropTypes.func.isRequired push: PropTypes.func.isRequired,
fetchRootFolders: PropTypes.func.isRequired
}; };
export default connect(createMapStateToProps, mapDispatchToProps)(MovieDetailsPageConnector); export default connect(createMapStateToProps, mapDispatchToProps)(MovieDetailsPageConnector);

View File

@ -21,6 +21,7 @@ function EditImportListModalContent(props) {
advancedSettings, advancedSettings,
isFetching, isFetching,
error, error,
rootFolderError,
isSaving, isSaving,
isTesting, isTesting,
saveError, saveError,
@ -62,14 +63,14 @@ function EditImportListModalContent(props) {
} }
{ {
!isFetching && !!error && !isFetching && (!!error || !!rootFolderError) &&
<div> <div>
{translate('UnableToAddANewListPleaseTryAgain')} {translate('UnableToAddANewListPleaseTryAgain')}
</div> </div>
} }
{ {
!isFetching && !error && !isFetching && !error && !rootFolderError &&
<Form <Form
{...otherProps} {...otherProps}
> >
@ -239,6 +240,7 @@ EditImportListModalContent.propTypes = {
advancedSettings: PropTypes.bool.isRequired, advancedSettings: PropTypes.bool.isRequired,
isFetching: PropTypes.bool.isRequired, isFetching: PropTypes.bool.isRequired,
error: PropTypes.object, error: PropTypes.object,
rootFolderError: PropTypes.object,
isSaving: PropTypes.bool.isRequired, isSaving: PropTypes.bool.isRequired,
isTesting: PropTypes.bool.isRequired, isTesting: PropTypes.bool.isRequired,
saveError: PropTypes.object, saveError: PropTypes.object,

View File

@ -9,11 +9,21 @@ import EditImportListModalContent from './EditImportListModalContent';
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
(state) => state.settings.advancedSettings, (state) => state.settings.advancedSettings,
(state) => state.rootFolders,
createProviderSettingsSelector('importLists'), createProviderSettingsSelector('importLists'),
(advancedSettings, importList) => { (advancedSettings, rootFolders, importList) => {
const {
isFetching,
isPopulated,
...otherProps
} = importList;
return { return {
advancedSettings, advancedSettings,
...importList isFetching: rootFolders.isFetching || isFetching,
isPopulated: rootFolders.isPopulated && isPopulated,
rootFolderError: rootFolders.error,
...otherProps
}; };
} }
); );