From 2eb6af10ba6c4949cdafe79418f575f2f290e348 Mon Sep 17 00:00:00 2001 From: Dan Peterson Date: Thu, 30 Dec 2021 11:36:56 -0600 Subject: [PATCH] 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. --- ui/component/publishForm/view.jsx | 7 ------- ui/component/publishReleaseDate/view.jsx | 8 +++++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ui/component/publishForm/view.jsx b/ui/component/publishForm/view.jsx index 9b77515f9..d4df2889d 100644 --- a/ui/component/publishForm/view.jsx +++ b/ui/component/publishForm/view.jsx @@ -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 (
diff --git a/ui/component/publishReleaseDate/view.jsx b/ui/component/publishReleaseDate/view.jsx index bb6ab0ff5..c45039c17 100644 --- a/ui/component/publishReleaseDate/view.jsx +++ b/ui/component/publishReleaseDate/view.jsx @@ -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 (