Skip to content

Commit

Permalink
fix edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Jan 6, 2021
1 parent 206016a commit bfcdfb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export const ConfigurationIssuesProvider: FunctionComponent = ({ children }) =>
],
});
const isUsingDefaultRollover = get(formData, isUsingDefaultRolloverPath);
const isUsingCustomRollover = get(formData, isUsingCustomRolloverPath);
// Provide default value, as path may become undefined if removed from the DOM
const isUsingCustomRollover = get(formData, isUsingCustomRolloverPath, true);

return (
<ConfigurationIssuesContext.Provider
value={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ export const createSerializer = (originalPolicy?: SerializedPolicy) => (
/**
* HOT PHASE ROLLOVER
*/
if (hotPhaseActions.rollover && isUsingRollover) {
if (isUsingRollover) {
if (_meta.hot.isUsingDefaultRollover) {
hotPhaseActions.rollover = cloneDeep(defaultRolloverAction);
} else {
// Rollover may not exist if editing an existing policy with initially no rollover configured
if (!hotPhaseActions.rollover) {
hotPhaseActions.rollover = {};
}

// We are using user-defined, custom rollover settings.
if (updatedPolicy.phases.hot!.actions.rollover?.max_age) {
hotPhaseActions.rollover.max_age = `${hotPhaseActions.rollover.max_age}${_meta.hot.customRollover.maxAgeUnit}`;
Expand Down

0 comments on commit bfcdfb4

Please sign in to comment.