@@ -67,7 +67,7 @@ const customImageUploadHandler = () =>
6767function TimeEntryForm ( props ) {
6868 /* ---------------- variables -------------- */
6969 // props from parent
70- const { from, sendStop, edit, data, toggle, isOpen, tab, darkMode, userProfile, userProjects } = props ;
70+ const { from, sendStop, edit, data, toggle, isOpen, tab, darkMode, userProfile, userProjects, timerConnected } = props ;
7171 // props from store
7272 const { authUser } = props ;
7373 const dispatch = useDispatch ( ) ;
@@ -317,6 +317,13 @@ function TimeEntryForm(props) {
317317 } ;
318318
319319 const submitTimeEntry = async ( ) => {
320+ // Prevent submission when logging timer time but timer is disconnected
321+ if ( from === 'Timer' && timerConnected === false ) {
322+ toast . error ( 'Cannot log time entry while timer is disconnected. Please wait for connection to be restored or refresh the page.' ) ;
323+ setSubmitting ( false ) ;
324+ return ;
325+ }
326+
320327 const { hours : formHours , minutes : formMinutes , personId, taskId } = formValues ;
321328 const timeEntry = { ...formValues } ;
322329 const isTimeModified = edit && ( initialHours !== formHours || initialMinutes !== formMinutes ) ;
@@ -827,6 +834,7 @@ TimeEntryForm.propTypes = {
827834 isOpen : PropTypes . bool . isRequired ,
828835 data : PropTypes . any . isRequired ,
829836 handleStop : PropTypes . func ,
837+ timerConnected : PropTypes . bool ,
830838} ;
831839
832840const mapStateToProps = state => ( {
0 commit comments