-
Notifications
You must be signed in to change notification settings - Fork 4
shunt compensator creation dialog migration TS #3619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
| [MAX_Q_AT_NOMINAL_V]: yup.number().nullable().min(0, 'ShuntCompensatorErrorQAtNominalVoltageLessThanZero'), | ||
| [MAX_SUSCEPTANCE]: yup.number().nullable(), | ||
| [MAXIMUM_SECTION_COUNT]: yup.number().min(1, 'MaximumSectionCountMustBeGreaterOrEqualToOne').nullable(), | ||
| [MAXIMUM_SECTION_COUNT]: yup.number().nullable().min(1, 'MaximumSectionCountMustBeGreaterOrEqualToOne'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [MAXIMUM_SECTION_COUNT]: yup.number().nullable().min(1, 'MaximumSectionCountMustBeGreaterOrEqualToOne'), | |
| [MAXIMUM_SECTION_COUNT]: yup.number().min(1, 'MaximumSectionCountMustBeGreaterOrEqualToOne').nullable(), |
|
|
||
| export type CharacteristicsFormProps = { | ||
| previousValues?: ShuntCompensatorFormInfos; | ||
| isModification?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| isModification?: boolean; | |
| isModification: boolean; |
Why question mark if we have a default value ?
| const previousMaxQAtNominalV = useMemo(() => { | ||
| const previousValue = previousValues?.qatNominalV * previousValues?.maximumSectionCount; | ||
| return isNaN(previousValue) ? null : previousValue; | ||
| const prevValue = previousValues && previousValues?.qAtNominalV * previousValues?.maximumSectionCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const prevValue = previousValues && previousValues?.qAtNominalV * previousValues?.maximumSectionCount; | |
| const prevValue = previousValues && previousValues.qAtNominalV * previousValues.maximumSectionCount; |
| const previousMaxSusceptance = useMemo(() => { | ||
| const previousValue = previousValues?.bperSection * previousValues?.maximumSectionCount; | ||
| return isNaN(previousValue) ? null : previousValue; | ||
| const prevValue = previousValues && previousValues?.bPerSection * previousValues?.maximumSectionCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| label={'SwitchedOnMaxQAtNominalV'} | ||
| adornment={ReactivePowerAdornment} | ||
| previousValue={previousValues?.qatNominalV * previousValues?.sectionCount} | ||
| previousValue={previousValues && previousValues?.qAtNominalV * previousValues?.sectionCount} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
| label={'SwitchedOnMaxSusceptance'} | ||
| adornment={SusceptanceAdornment} | ||
| previousValue={previousValues?.bperSection * previousValues?.sectionCount} | ||
| previousValue={previousValues && previousValues?.bPerSection * previousValues?.sectionCount} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same there is no need of question mark when you already checked if the value exists.
| [EQUIPMENT_ID]: yup.string().required(), | ||
| [EQUIPMENT_NAME]: yup.string().nullable(), | ||
| ...getConnectivityWithPositionValidationSchema(), | ||
| [CONNECTIVITY]: getConnectivityWithPositionSchema(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use the id field at as it's done for other function
| [MAX_Q_AT_NOMINAL_V]?: number | null; | ||
| [MAX_SUSCEPTANCE]?: number | null; | ||
| [MAXIMUM_SECTION_COUNT]?: number | null; | ||
| [SECTION_COUNT]?: number | null; | ||
| [SWITCHED_ON_Q_AT_NOMINAL_V]?: number | null; | ||
| [SWITCHED_ON_SUSCEPTANCE]?: number | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to number | null | undefined
We should do this only if null is different from optional and is a valid value
If the field is optional, we should remove this null type and use optional() instead of nullable() on the yup schema
| shuntCompensatorCreationInfos: ShuntCompensatorCreationInfos; | ||
| studyUuid: UUID; | ||
| nodeUuid: UUID; | ||
| modificationUuid?: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why null?
| maxSusceptance?: number | null; | ||
| maxQAtNominalV?: number | null; | ||
| shuntCompensatorType?: string | null; | ||
| sectionCount?: number | null; | ||
| maximumSectionCount?: number | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, except if you have a good reason, you shouldn't use null with undefined.




PR Summary
shunt compensator creation dialog migration TS