UI Action Handler Changes, Misc Fixes

This commit is contained in:
Qstick
2017-11-26 15:09:45 -05:00
parent 7825319d89
commit cd5b658196
193 changed files with 6992 additions and 6341 deletions
@@ -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 });
}