diff --git a/ui/component/publish/shared/publishStreamReleaseDate/view.jsx b/ui/component/publish/shared/publishStreamReleaseDate/view.jsx index 8df00bce80..de8953c32a 100644 --- a/ui/component/publish/shared/publishStreamReleaseDate/view.jsx +++ b/ui/component/publish/shared/publishStreamReleaseDate/view.jsx @@ -22,7 +22,8 @@ type Props = { const PublishStreamReleaseDate = (props: Props) => { const { isScheduled, releaseTime, clock24h, appLanguage, updatePublishForm } = props; - const [publishLater, setPublishLater] = React.useState(isScheduled); + const minScheduledTimePassed = releaseTime ? releaseTime < dateToLinuxTimestamp(moment().toDate()) : undefined; + const [publishLater, setPublishLater] = React.useState(isScheduled && !minScheduledTimePassed); const getPlus30MinutesDate = () => { return moment().add('1', 'hour').add('30', 'minutes').startOf('hour').toDate(); @@ -50,14 +51,6 @@ const PublishStreamReleaseDate = (props: Props) => { 'Your scheduled streams will appear on your channel page and for your followers. Chat will not be active until 5 minutes before the start time.' ); - React.useEffect(() => { - if (isScheduled) { - // TODO: this is doPrepareEdit's responsibility, not the component's. - updatePublishForm({ releaseTime: dateToLinuxTimestamp(getPlus30MinutesDate()) }); - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- on mount only - }, []); - return ( <>
diff --git a/ui/redux/actions/publish.js b/ui/redux/actions/publish.js index be58f84d78..53af61a323 100644 --- a/ui/redux/actions/publish.js +++ b/ui/redux/actions/publish.js @@ -590,6 +590,7 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, claimType: string title, tags, stream_type, + release_time, } = value; let state = getState(); @@ -749,6 +750,8 @@ export const doPrepareEdit = (claim: StreamClaim, uri: string, claimType: string dispatch(doSetIncognito(true)); } + publishData.releaseTime = Number(release_time); + dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData }); dispatch(push(`/$/${PUBLISH_PATH_MAP[type]}`)); };