Skip to content

Commit

Permalink
Merge pull request #2996 from bcgov/form_lag
Browse files Browse the repository at this point in the history
typing lag on second template
  • Loading branch information
micheal-w-wells authored Dec 5, 2023
2 parents df12aef + af5a3b3 commit a69d078
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 114 deletions.
178 changes: 139 additions & 39 deletions appv2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions appv2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"@mui/x-data-grid": "^5.17.18",
"@react-leaflet/core": "^2.1.0",
"@reduxjs/toolkit": "^1.9.5",
"@rjsf/core": "^5.0.0-beta.15",
"@rjsf/mui": "^5.0.0-beta.15",
"@rjsf/utils": "^5.0.0-beta.15",
"@rjsf/validator-ajv6": "^5.0.0-beta.15",
"@rjsf/core": "^5.15.0",
"@rjsf/mui": "^5.15.0",
"@rjsf/utils": "^5.15.0",
"@rjsf/validator-ajv8": "^5.15.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/user-event": "^8.1.3",
"@tmcw/togeojson": "^4.4.1",
Expand Down
5 changes: 3 additions & 2 deletions appv2/src/UI/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const AppUrlListener: React.FC<any> = () => {
return null;
};

const OverlayContentMemo = React.memo((props: any) => {
const OverlayContentMemo = (props) => {//React.memo((props: any) => {
const overlayMenuOpen = useSelector((state: any) => state.AppMode?.overlay_menu_toggle);
const fullScreen = useSelector((state: any) => state.AppMode?.panelFullScreen);
const theme = createTheme(getDesignTokens(false) as ThemeOptions);
Expand Down Expand Up @@ -133,7 +133,8 @@ const OverlayContentMemo = React.memo((props: any) => {
<Route path="/WhatsHere" render={(props) => <WhatsHereTable />} />
</div>
);
});
}
//});

const HeaderMemo = React.memo((props: any) => {
const ref = useRef(0);
Expand Down
2 changes: 1 addition & 1 deletion appv2/src/UI/Overlay/Admin/email-setup/EmailSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RJSFSchema, UiSchema } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv6';
import validator from '@rjsf/validator-ajv8';
import React, { useEffect } from 'react';
import { Form } from '@rjsf/mui';
import {
Expand Down
2 changes: 1 addition & 1 deletion appv2/src/UI/Overlay/Admin/email-setup/EmailTemplates.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Card, CardContent, Grid } from '@mui/material';
import { Form } from '@rjsf/mui';
import { RJSFSchema, UiSchema } from '@rjsf/utils';
import validator from '@rjsf/validator-ajv6';
import validator from '@rjsf/validator-ajv8';
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { EMAIL_TEMPLATES_RETRIEVE_REQUEST, EMAIL_TEMPLATES_SET_ACTIVE, EMAIL_TEMPLATES_UPDATE } from 'state/actions';
Expand Down
31 changes: 8 additions & 23 deletions appv2/src/UI/Overlay/Records/Activity/Form.tsx
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
/>
);
};
Loading

0 comments on commit a69d078

Please sign in to comment.