-
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.
Merge pull request #2996 from bcgov/form_lag
typing lag on second template
- Loading branch information
Showing
9 changed files
with
211 additions
and
114 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 | ||
/> | ||
); | ||
}; |
Oops, something went wrong.