-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip - move state out of props and rewrite state grabs to reduce reren…
…ders - still typing lag from somewhere
- Loading branch information
1 parent
df12aef
commit 8408136
Showing
5 changed files
with
60 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,19 @@ | ||
import React, { useCallback, useEffect, useState } from 'react'; | ||
import React from 'react'; | ||
import FormContainer from './form/FormContainer'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { selectActivity } from 'state/reducers/activity'; | ||
import _ from 'lodash'; | ||
import { ACTIVITY_ON_FORM_CHANGE_REQUEST } from 'state/actions'; | ||
import { validatorForActivity } from 'rjsf/business-rules/customValidation'; | ||
|
||
export const ActivityForm = (props) => { | ||
const activityState = useSelector(selectActivity); | ||
const dispatch = useDispatch(); | ||
|
||
const debouncedFormChange = | ||
_.debounce((event, ref, lastField, callbackFun) => { | ||
dispatch({ | ||
type: ACTIVITY_ON_FORM_CHANGE_REQUEST, | ||
payload: { eventFormData: event.formData, lastField: lastField, unsavedDelay: null} | ||
}); | ||
}, 150) | ||
|
||
return ( | ||
<FormContainer | ||
activity={activityState.activity} | ||
isAlreadySubmitted={function (): boolean { | ||
return activityState.activity.form_status === 'Submitted' | ||
}} | ||
canBeSubmittedWithoutErrors={function (): boolean { | ||
// isAlreadySubmitted={function (): boolean { | ||
// return activityState.activity.form_status === 'Submitted' | ||
// }} | ||
/* canBeSubmittedWithoutErrors={function (): boolean { | ||
return false; | ||
}} | ||
onFormChange={debouncedFormChange} | ||
customValidation={validatorForActivity(activityState.activity, null)} //linked activity | ||
*/ | ||
//onFormChange={debouncedFormChange} | ||
// customValidation={validatorForActivity(activityState.activity, null)} //linked activity | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters