Update date/time cmpnts to reset any chnages they made on umount. Update schedule date/time cmpnt to clear release time when selecting anytime option.

This commit is contained in:
Dan Peterson 2021-12-30 11:36:56 -06:00 committed by Thomas Zarebczan
parent fef289e4fe
commit 2eb6af10ba
2 changed files with 7 additions and 8 deletions

View file

@ -569,13 +569,6 @@ function PublishForm(props: Props) {
setShowSchedulingOptions(isLivestreamMode && fileSelectSource === SOURCE_NONE);
}, [isLivestreamMode, fileSelectSource]);
// Reset any set release time if switching to live stream mode.
useEffect(() => {
if (mode === PUBLISH_MODES.LIVESTREAM) {
updatePublishForm({ releaseTimeEdited: undefined });
}
}, [mode, updatePublishForm]);
if (publishing) {
return (
<div className="main--empty">

View file

@ -1,5 +1,5 @@
// @flow
import React from 'react';
import React, { useEffect } from 'react';
import Button from 'component/button';
import DateTimePicker from 'react-datetime-picker';
@ -86,6 +86,12 @@ const PublishReleaseDate = (props: Props) => {
}
}
useEffect(() => {
return () => {
updatePublishForm({ releaseTimeEdited: undefined });
};
}, []);
return (
<div className="form-field-date-picker">
<label>{__('Release date')}</label>