Skip to content

Instantly share code, notes, and snippets.

@euanmillar
Created January 23, 2025 17:39
Show Gist options
  • Save euanmillar/e00a3d2b1d6656f1e59b6f5e4df625c4 to your computer and use it in GitHub Desktop.
Save euanmillar/e00a3d2b1d6656f1e59b6f5e4df625c4 to your computer and use it in GitHub Desktop.
diff --git a/packages/client/src/components/form/FormFieldGenerator.tsx b/packages/client/src/components/form/FormFieldGenerator.tsx
index 2198471777..df8cf11785 100644
--- a/packages/client/src/components/form/FormFieldGenerator.tsx
+++ b/packages/client/src/components/form/FormFieldGenerator.tsx
@@ -191,7 +191,6 @@ type GeneratedInputFieldProps = {
touched: boolean
error: string
draftData: IFormData
- draftId: string
disabled?: boolean
onUploadingStateChanged?: (isUploading: boolean) => void
requiredErrorMessage?: MessageDescriptor
@@ -211,7 +210,6 @@ const GeneratedInputField = React.memo<GeneratedInputFieldProps>(
value,
nestedFields,
draftData,
- draftId,
disabled,
dynamicDispatch,
onUploadingStateChanged,
@@ -666,7 +664,6 @@ const GeneratedInputField = React.memo<GeneratedInputFieldProps>(
<LinkButtonField
form={values}
draft={draftData}
- draftId={draftId}
fieldDefinition={fieldDefinition}
fields={fields}
setFieldValue={setFieldValue}
@@ -810,7 +807,7 @@ export const mapFieldsToValues = (
}, {})
type ISetTouchedFunction = (touched: FormikTouched<FormikValues>) => void
-interface IFormFieldGeneratorProps {
+interface IFormSectionProps {
fields: IFormField[]
id: string
fieldsToShowValidationErrors?: IFormField[]
@@ -821,7 +818,6 @@ interface IFormFieldGeneratorProps {
requiredErrorMessage?: MessageDescriptor
onUploadingStateChanged?: (isUploading: boolean) => void
initialValues?: IAdvancedSearchFormState
- draftId: string
}
interface IStateProps {
@@ -833,7 +829,7 @@ interface IDispatchProps {
dynamicDispatch: typeof dynamicDispatch
}
-type Props = IFormFieldGeneratorProps &
+type Props = IFormSectionProps &
IStateProps &
IDispatchProps &
FormikProps<IFormSectionData> &
@@ -943,7 +939,6 @@ class FormSectionComponent extends React.Component<Props> {
updatedValues,
this.props.offlineCountryConfig,
this.props.draftData,
- this.props.draftId,
this.props.userDetails
)
updateDependentFields(field.name)
@@ -994,7 +989,6 @@ class FormSectionComponent extends React.Component<Props> {
offlineCountryConfig,
intl,
draftData,
- draftId,
userDetails,
setValues,
dynamicDispatch
@@ -1022,7 +1016,6 @@ class FormSectionComponent extends React.Component<Props> {
{ ...draftData?.[sectionName], ...values },
offlineCountryConfig,
draftData,
- draftId,
userDetails
)
@@ -1189,7 +1182,6 @@ class FormSectionComponent extends React.Component<Props> {
fields={fields}
values={values}
draftData={draftData}
- draftId={draftId}
disabled={isFieldDisabled}
dynamicDispatch={dynamicDispatch}
/>
@@ -1252,7 +1244,6 @@ class FormSectionComponent extends React.Component<Props> {
touched={nestedFieldTouched || false}
error={nestedError}
draftData={draftData}
- draftId={draftId}
dynamicDispatch={dynamicDispatch}
onUploadingStateChanged={
this.props.onUploadingStateChanged
@@ -1292,7 +1283,6 @@ class FormSectionComponent extends React.Component<Props> {
fields={fields}
values={values}
draftData={draftData}
- draftId={draftId}
dynamicDispatch={dynamicDispatch}
/>
)}
@@ -1322,7 +1312,6 @@ class FormSectionComponent extends React.Component<Props> {
touched={touched[field.name] || false}
error={isFieldDisabled ? '' : error}
draftData={draftData}
- draftId={draftId}
fields={fields}
values={values}
dynamicDispatch={dynamicDispatch}
@@ -1343,9 +1332,7 @@ class FormSectionComponent extends React.Component<Props> {
}
}
-export const FormFieldGenerator: React.FC<IFormFieldGeneratorProps> = (
- props
-) => {
+export const FormFieldGenerator: React.FC<IFormSectionProps> = (props) => {
const offlineCountryConfig = useSelector(getOfflineData)
const userDetails = useSelector(getUserDetails)
const intl = useIntl()
diff --git a/packages/client/src/components/form/LinkButton.tsx b/packages/client/src/components/form/LinkButton.tsx
index 70b9d101c5..645560cd6b 100644
--- a/packages/client/src/components/form/LinkButton.tsx
+++ b/packages/client/src/components/form/LinkButton.tsx
@@ -29,7 +29,6 @@ export const LinkButtonField = ({
fields,
form,
draft,
- draftId,
fieldDefinition,
setFieldValue,
isDisabled
@@ -37,7 +36,6 @@ export const LinkButtonField = ({
fields: IFormField[]
form: IFormSectionData
draft: IFormData
- draftId: string
fieldDefinition: Ii18nLinkButtonFormField
setFieldValue: (name: string, value: IFormFieldValue) => void
isDisabled?: boolean
@@ -100,7 +98,6 @@ export const LinkButtonField = ({
form,
config,
draft,
- draftId,
user
)
}}
diff --git a/packages/client/src/forms/utils.ts b/packages/client/src/forms/utils.ts
index af94dfa75b..290327af0b 100644
--- a/packages/client/src/forms/utils.ts
+++ b/packages/client/src/forms/utils.ts
@@ -574,7 +574,6 @@ export const getConditionalActionsForField = (
values: IFormSectionData,
offlineCountryConfig: IOfflineData,
draftData: IFormData,
- draftId: string,
userDetails: UserDetails | null
): string[] => {
if (!field.conditionals) {
@@ -589,7 +588,6 @@ export const getConditionalActionsForField = (
values,
offlineCountryConfig,
draftData,
- draftId,
userDetails
)
)
@@ -605,7 +603,6 @@ export const evalExpressionInFieldDefinition = (
$form: IFormSectionData,
$config: IOfflineData,
$draft: IFormData,
- $draftId: string,
$user: (UserDetails & { token?: string }) | null
) => {
// For backwards compatibility
@@ -613,7 +610,6 @@ export const evalExpressionInFieldDefinition = (
const values = $form
const offlineCountryConfig = $config
const draftData = $draft
- const draftId = $draftId
const userDetails = $user
/* eslint-enable @typescript-eslint/no-unused-vars */
diff --git a/packages/client/src/views/RegisterForm/RegisterForm.tsx b/packages/client/src/views/RegisterForm/RegisterForm.tsx
index 585c71b402..c3322bc1af 100644
--- a/packages/client/src/views/RegisterForm/RegisterForm.tsx
+++ b/packages/client/src/views/RegisterForm/RegisterForm.tsx
@@ -1068,7 +1068,6 @@ class RegisterFormView extends React.Component<FullProps, State> {
declaration.data[activeSection.id],
config,
declaration.data,
- declaration.id,
userDetails
)
: true
@@ -1296,7 +1295,6 @@ class RegisterFormView extends React.Component<FullProps, State> {
activeSectionGroup
)}
draftData={declaration.data}
- draftId={declaration.id}
onSetTouched={(setTouchedFunc) => {
this.setAllFormFieldsTouched = setTouchedFunc
}}
diff --git a/packages/client/src/views/RegisterForm/review/ReviewSection.tsx b/packages/client/src/views/RegisterForm/review/ReviewSection.tsx
index 73c53335c5..7db662cfe3 100644
--- a/packages/client/src/views/RegisterForm/review/ReviewSection.tsx
+++ b/packages/client/src/views/RegisterForm/review/ReviewSection.tsx
@@ -1938,7 +1938,6 @@ class ReviewSectionComp extends React.Component<FullProps, State> {
setAllFieldsDirty={false}
fields={reviewSection.groups[0].fields}
draftData={declaration.data}
- draftId={declaration.id}
initialValues={
declaration.data.preview ?? declaration.data.review
}
diff --git a/packages/client/src/views/RegisterForm/review/ReviewSectionCorrection.tsx b/packages/client/src/views/RegisterForm/review/ReviewSectionCorrection.tsx
index 17bcc1b489..7a34833d52 100644
--- a/packages/client/src/views/RegisterForm/review/ReviewSectionCorrection.tsx
+++ b/packages/client/src/views/RegisterForm/review/ReviewSectionCorrection.tsx
@@ -238,7 +238,6 @@ class ReviewSectionCorrectionComp extends React.Component<FullProps, State> {
onChange={this.storeData}
setAllFieldsDirty={false}
draftData={this.props.declaration.data}
- draftId={this.props.declaration.id}
/>
</Dialog>
</>
diff --git a/yarn.lock b/yarn.lock
index f8a40fd19d..b4ee563673 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -23628,7 +23628,16 @@ string-similarity@^4.0.1:
resolved "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz"
integrity sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==
-"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
+"string-width-cjs@npm:string-width@^4.2.0":
+ version "4.2.3"
+ resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
+ integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
+ dependencies:
+ emoji-regex "^8.0.0"
+ is-fullwidth-code-point "^3.0.0"
+ strip-ansi "^6.0.1"
+
+"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -23788,7 +23797,7 @@ stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"
-"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -23809,6 +23818,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"
+strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+ version "6.0.1"
+ resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
+ integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
+ dependencies:
+ ansi-regex "^5.0.1"
+
strip-ansi@^7.0.1, strip-ansi@^7.1.0:
version "7.1.0"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz"
@@ -26122,7 +26138,7 @@ [email protected], workbox-window@^7.1.0:
"@types/trusted-types" "^2.0.2"
workbox-core "7.1.0"
-"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
+"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -26149,6 +26165,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"
+wrap-ansi@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
+ integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
+ dependencies:
+ ansi-styles "^4.0.0"
+ string-width "^4.1.0"
+ strip-ansi "^6.0.0"
+
wrap-ansi@^8.0.1, wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment