persist publish language

fix publish language default
This commit is contained in:
zeppi 2020-11-16 17:35:25 -05:00 committed by Sean Yesmunt
parent 70c52e42e8
commit eb40d2c058
3 changed files with 19 additions and 12 deletions

17
dist/bundle.es.js vendored
View file

@ -4163,16 +4163,18 @@ const selectIsStillEditing = reselect.createSelector(selectState$3, publishState
return currentName === editName; return currentName === editName;
}); });
const selectPublishFormValues = reselect.createSelector(selectState$3, selectIsStillEditing, (state, isStillEditing) => { const selectPublishFormValues = reselect.createSelector(selectState$3, state => state.settings, selectIsStillEditing, (publishState, settingsState, isStillEditing) => {
const { pendingPublish, language, languages } = state, const { pendingPublish, language } = publishState,
formValues = _objectWithoutProperties$2(state, ['pendingPublish', 'language', 'languages']); formValues = _objectWithoutProperties$2(publishState, ['pendingPublish', 'language']);
const { clientSettings } = settingsState;
const { language: languageSet } = clientSettings;
let actualLanguage; let actualLanguage;
// Sets default if editing a claim with a set language // Sets default if editing a claim with a set language
if (!language && isStillEditing && languages && languages[0]) { if (!language && isStillEditing && languageSet) {
actualLanguage = languages[0]; actualLanguage = languageSet;
} else { } else {
actualLanguage = language || 'en'; actualLanguage = language || languageSet || 'en';
} }
return _extends$6({}, formValues, { language: actualLanguage }); return _extends$6({}, formValues, { language: actualLanguage });
}); });
@ -5674,7 +5676,8 @@ const publishReducer = handleActions({
[CLEAR_PUBLISH]: state => _extends$c({}, defaultState$4, { [CLEAR_PUBLISH]: state => _extends$c({}, defaultState$4, {
channel: state.channel, channel: state.channel,
bid: state.bid, bid: state.bid,
optimize: state.optimize optimize: state.optimize,
language: state.language
}), }),
[PUBLISH_START]: state => _extends$c({}, state, { [PUBLISH_START]: state => _extends$c({}, state, {
publishing: true, publishing: true,

View file

@ -86,6 +86,7 @@ export const publishReducer = handleActions(
channel: state.channel, channel: state.channel,
bid: state.bid, bid: state.bid,
optimize: state.optimize, optimize: state.optimize,
language: state.language,
}), }),
[ACTIONS.PUBLISH_START]: (state: PublishState): PublishState => ({ [ACTIONS.PUBLISH_START]: (state: PublishState): PublishState => ({
...state, ...state,

View file

@ -40,16 +40,19 @@ export const selectIsStillEditing = createSelector(
export const selectPublishFormValues = createSelector( export const selectPublishFormValues = createSelector(
selectState, selectState,
state => state.settings,
selectIsStillEditing, selectIsStillEditing,
(state, isStillEditing) => { (publishState, settingsState, isStillEditing) => {
const { pendingPublish, language, languages, ...formValues } = state; const { pendingPublish, language, ...formValues } = publishState;
const { clientSettings } = settingsState;
const { language: languageSet } = clientSettings;
let actualLanguage; let actualLanguage;
// Sets default if editing a claim with a set language // Sets default if editing a claim with a set language
if (!language && isStillEditing && languages && languages[0]) { if (!language && isStillEditing && languageSet) {
actualLanguage = languages[0]; actualLanguage = languageSet;
} else { } else {
actualLanguage = language || 'en'; actualLanguage = language || languageSet || 'en';
} }
return { ...formValues, language: actualLanguage }; return { ...formValues, language: actualLanguage };
} }