mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
UI Action Handler Changes, Misc Fixes
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import _ from 'lodash';
|
||||
import getSectionState from 'Utilities/State/getSectionState';
|
||||
|
||||
function getProviderState(payload, getState, getFromState) {
|
||||
function getProviderState(payload, getState, section) {
|
||||
const id = payload.id;
|
||||
const state = getFromState(getState());
|
||||
const state = getSectionState(getState(), section, true);
|
||||
const pendingChanges = Object.assign({}, state.pendingChanges);
|
||||
const pendingFields = state.pendingChanges.fields || {};
|
||||
delete pendingChanges.fields;
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
function getSectionState(state, section) {
|
||||
import _ from 'lodash';
|
||||
|
||||
function getSectionState(state, section, isFullStateTree = false) {
|
||||
if (isFullStateTree) {
|
||||
return _.get(state, section);
|
||||
}
|
||||
|
||||
const [, subSection] = section.split('.');
|
||||
|
||||
if (subSection) {
|
||||
return Object.assign({}, state[subSection]);
|
||||
}
|
||||
|
||||
// TODO: Remove in favour of using subSection
|
||||
if (state.hasOwnProperty(section)) {
|
||||
return Object.assign({}, state[section]);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
function updateSectionState(state, section, newState) {
|
||||
const [, subSection] = section.split('.');
|
||||
|
||||
if (subSection) {
|
||||
return Object.assign({}, state, { [subSection]: newState });
|
||||
}
|
||||
|
||||
// TODO: Remove in favour of using subSection
|
||||
if (state.hasOwnProperty(section)) {
|
||||
return Object.assign({}, state, { [section]: newState });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user