diff --git a/frontend/src/Settings/DownloadClients/Options/DownloadClientOptionsConnector.js b/frontend/src/Settings/DownloadClients/Options/DownloadClientOptionsConnector.js
index 2c5c78c7e..4dd67f356 100644
--- a/frontend/src/Settings/DownloadClients/Options/DownloadClientOptionsConnector.js
+++ b/frontend/src/Settings/DownloadClients/Options/DownloadClientOptionsConnector.js
@@ -21,10 +21,10 @@ function createMapStateToProps() {
}
const mapDispatchToProps = {
- fetchDownloadClientOptions,
- setDownloadClientOptionsValue,
- saveDownloadClientOptions,
- clearPendingChanges
+ dispatchFetchDownloadClientOptions: fetchDownloadClientOptions,
+ dispatchSetDownloadClientOptionsValue: setDownloadClientOptionsValue,
+ dispatchSaveDownloadClientOptions: saveDownloadClientOptions,
+ dispatchClearPendingChanges: clearPendingChanges
};
class DownloadClientOptionsConnector extends Component {
@@ -33,31 +33,43 @@ class DownloadClientOptionsConnector extends Component {
// Lifecycle
componentDidMount() {
- this.props.fetchDownloadClientOptions();
+ const {
+ dispatchFetchDownloadClientOptions,
+ dispatchSaveDownloadClientOptions,
+ onChildMounted
+ } = this.props;
+
+ dispatchFetchDownloadClientOptions();
+ onChildMounted(dispatchSaveDownloadClientOptions);
}
componentDidUpdate(prevProps) {
- if (this.props.hasPendingChanges !== prevProps.hasPendingChanges) {
- this.props.onHasPendingChange(this.props.hasPendingChanges);
+ const {
+ hasPendingChanges,
+ isSaving,
+ onChildStateChange
+ } = this.props;
+
+ if (
+ prevProps.isSaving !== isSaving ||
+ prevProps.hasPendingChanges !== hasPendingChanges
+ ) {
+ onChildStateChange({
+ isSaving,
+ hasPendingChanges
+ });
}
}
componentWillUnmount() {
- this.props.clearPendingChanges({ section: this.props.section });
- }
-
- //
- // Control
-
- save = () => {
- this.props.saveDownloadClientOptions();
+ this.props.dispatchClearPendingChanges({ section: this.props.section });
}
//
// Listeners
onInputChange = ({ name, value }) => {
- this.props.setDownloadClientOptionsValue({ name, value });
+ this.props.dispatchSetDownloadClientOptionsValue({ name, value });
}
//
@@ -75,18 +87,20 @@ class DownloadClientOptionsConnector extends Component {
DownloadClientOptionsConnector.propTypes = {
section: PropTypes.string.isRequired,
+ isSaving: PropTypes.bool.isRequired,
hasPendingChanges: PropTypes.bool.isRequired,
- fetchDownloadClientOptions: PropTypes.func.isRequired,
- setDownloadClientOptionsValue: PropTypes.func.isRequired,
- saveDownloadClientOptions: PropTypes.func.isRequired,
- clearPendingChanges: PropTypes.func.isRequired,
- onHasPendingChange: PropTypes.func.isRequired
+ dispatchFetchDownloadClientOptions: PropTypes.func.isRequired,
+ dispatchSetDownloadClientOptionsValue: PropTypes.func.isRequired,
+ dispatchSaveDownloadClientOptions: PropTypes.func.isRequired,
+ dispatchClearPendingChanges: PropTypes.func.isRequired,
+ onChildMounted: PropTypes.func.isRequired,
+ onChildStateChange: PropTypes.func.isRequired
};
export default connectSection(
createMapStateToProps,
mapDispatchToProps,
undefined,
- { withRef: true },
+ undefined,
{ section: 'settings.downloadClientOptions' }
)(DownloadClientOptionsConnector);
diff --git a/frontend/src/Settings/General/HostSettings.js b/frontend/src/Settings/General/HostSettings.js
index 0c91d5e67..3e8941555 100644
--- a/frontend/src/Settings/General/HostSettings.js
+++ b/frontend/src/Settings/General/HostSettings.js
@@ -49,6 +49,8 @@ function HostSettings(props) {
diff --git a/frontend/src/Settings/Indexers/IndexerSettings.js b/frontend/src/Settings/Indexers/IndexerSettings.js
index 2e526c080..3b42dc2e5 100644
--- a/frontend/src/Settings/Indexers/IndexerSettings.js
+++ b/frontend/src/Settings/Indexers/IndexerSettings.js
@@ -14,7 +14,10 @@ class IndexerSettings extends Component {
constructor(props, context) {
super(props, context);
+ this._saveCallback = null;
+
this.state = {
+ isSaving: false,
hasPendingChanges: false
};
}
@@ -22,28 +25,34 @@ class IndexerSettings extends Component {
//
// Listeners
- setIndexerOptionsRef = (ref) => {
- this._indexerOptions = ref;
+ onChildMounted = (saveCallback) => {
+ this._saveCallback = saveCallback;
}
- onHasPendingChange = (hasPendingChanges) => {
- this.setState({
- hasPendingChanges
- });
+ onChildStateChange = (payload) => {
+ this.setState(payload);
}
onSavePress = () => {
- this._indexerOptions.getWrappedInstance().save();
+ if (this._saveCallback) {
+ this._saveCallback();
+ }
}
//
// Render
render() {
+ const {
+ isSaving,
+ hasPendingChanges
+ } = this.state;
+
return (
@@ -51,8 +60,8 @@ class IndexerSettings extends Component {
diff --git a/frontend/src/Settings/Indexers/Indexers/Indexer.js b/frontend/src/Settings/Indexers/Indexers/Indexer.js
index 379e818b8..27ce30f44 100644
--- a/frontend/src/Settings/Indexers/Indexers/Indexer.js
+++ b/frontend/src/Settings/Indexers/Indexers/Indexer.js
@@ -76,6 +76,7 @@ class Indexer extends Component {
return (
diff --git a/frontend/src/Settings/Indexers/Options/IndexerOptions.js b/frontend/src/Settings/Indexers/Options/IndexerOptions.js
index d47a3ca3c..b4b0de2b7 100644
--- a/frontend/src/Settings/Indexers/Options/IndexerOptions.js
+++ b/frontend/src/Settings/Indexers/Options/IndexerOptions.js
@@ -41,6 +41,7 @@ function IndexerOptions(props) {
{
- this.props.saveIndexerOptions();
+ this.props.dispatchClearPendingChanges({ section: this.props.section });
}
//
// Listeners
onInputChange = ({ name, value }) => {
- this.props.setIndexerOptionsValue({ name, value });
+ this.props.dispatchSetIndexerOptionsValue({ name, value });
}
//
@@ -75,18 +87,20 @@ class IndexerOptionsConnector extends Component {
IndexerOptionsConnector.propTypes = {
section: PropTypes.string.isRequired,
+ isSaving: PropTypes.bool.isRequired,
hasPendingChanges: PropTypes.bool.isRequired,
- fetchIndexerOptions: PropTypes.func.isRequired,
- setIndexerOptionsValue: PropTypes.func.isRequired,
- saveIndexerOptions: PropTypes.func.isRequired,
- clearPendingChanges: PropTypes.func.isRequired,
- onHasPendingChange: PropTypes.func.isRequired
+ dispatchFetchIndexerOptions: PropTypes.func.isRequired,
+ dispatchSetIndexerOptionsValue: PropTypes.func.isRequired,
+ dispatchSaveIndexerOptions: PropTypes.func.isRequired,
+ dispatchClearPendingChanges: PropTypes.func.isRequired,
+ onChildMounted: PropTypes.func.isRequired,
+ onChildStateChange: PropTypes.func.isRequired
};
export default connectSection(
createMapStateToProps,
mapDispatchToProps,
undefined,
- { withRef: true },
+ undefined,
{ section: 'settings.indexerOptions' }
)(IndexerOptionsConnector);
diff --git a/frontend/src/Settings/Indexers/Restrictions/Restriction.js b/frontend/src/Settings/Indexers/Restrictions/Restriction.js
index bdd457aca..07b7feece 100644
--- a/frontend/src/Settings/Indexers/Restrictions/Restriction.js
+++ b/frontend/src/Settings/Indexers/Restrictions/Restriction.js
@@ -64,6 +64,7 @@ class Restriction extends Component {
return (
diff --git a/frontend/src/Settings/Metadata/Metadata/Metadata.js b/frontend/src/Settings/Metadata/Metadata/Metadata.js
index fb6495f7c..392b4838f 100644
--- a/frontend/src/Settings/Metadata/Metadata/Metadata.js
+++ b/frontend/src/Settings/Metadata/Metadata/Metadata.js
@@ -52,6 +52,7 @@ class Metadata extends Component {
return (
diff --git a/frontend/src/Settings/Notifications/Notifications/Notification.js b/frontend/src/Settings/Notifications/Notifications/Notification.js
index cca3761fc..08017f6c5 100644
--- a/frontend/src/Settings/Notifications/Notifications/Notification.js
+++ b/frontend/src/Settings/Notifications/Notifications/Notification.js
@@ -79,6 +79,7 @@ class Notification extends Component {
return (
diff --git a/frontend/src/Settings/Profiles/Language/EditLanguageProfileModalContent.js b/frontend/src/Settings/Profiles/Language/EditLanguageProfileModalContent.js
index 947bd62ed..f6affee99 100644
--- a/frontend/src/Settings/Profiles/Language/EditLanguageProfileModalContent.js
+++ b/frontend/src/Settings/Profiles/Language/EditLanguageProfileModalContent.js
@@ -101,7 +101,7 @@ function EditLanguageProfileModalContent(props) {
id &&