diff --git a/public/pages/CreateSnapshotPolicy/components/CronSchedule/CronSchedule.tsx b/public/pages/CreateSnapshotPolicy/components/CronSchedule/CronSchedule.tsx index 78ed71fcf..6536e4e8d 100644 --- a/public/pages/CreateSnapshotPolicy/components/CronSchedule/CronSchedule.tsx +++ b/public/pages/CreateSnapshotPolicy/components/CronSchedule/CronSchedule.tsx @@ -55,6 +55,25 @@ const CronSchedule = ({ const [dayOfWeek, setWeek] = useState(initWeek); const [dayOfMonth, setMonth] = useState(initMonth); + // When edit policy is clicked, during the initial render DEFAULT values get passed + // As a result when the actual policy details are passed, the state does not get updated and we end up + // showing incorrect values in schedule controls. + if (initHour !== hour) { + setHour(initHour); + } + + if (initMin !== minute) { + setMinute(initMin); + } + + if (initWeek !== dayOfWeek) { + setWeek(initWeek); + } + + if (initMonth !== dayOfMonth) { + setMonth(initMonth); + } + useEffect(() => { changeCron(); }, [minute, hour, dayOfWeek, dayOfMonth]); diff --git a/public/pages/Snapshots/components/SnapshotFlyout/SnapshotFlyout.tsx b/public/pages/Snapshots/components/SnapshotFlyout/SnapshotFlyout.tsx index 8901f9ef6..bf3542a36 100644 --- a/public/pages/Snapshots/components/SnapshotFlyout/SnapshotFlyout.tsx +++ b/public/pages/Snapshots/components/SnapshotFlyout/SnapshotFlyout.tsx @@ -67,7 +67,7 @@ export default class SnapshotFlyout extends Component