Skip to content

Conversation

Mathieu-Deharbe
Copy link
Contributor

No description provided.

Mathieu-Deharbe and others added 8 commits September 16, 2025 18:22
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
…y from CurrentLimitsFormInfos

Signed-off-by: Mathieu DEHARBE <[email protected]>
export const TEMPORARY_LIMIT_VALUE = 'value';
export const TEMPORARY_LIMIT_MODIFICATION_TYPE = {
MODIFY: 'MODIFY',
MODIFY_OR_ADD: 'MODIFY_OR_ADD', // if the limit exists it is modified, if not it is created
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should rename it MODIFY OR ELSE ADD, it s easier to understand at first sight

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(in the back also)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right it would be clearer. Sadly I already merged MODIFY_OR_ADD for the operational limits groups equivalent. If I change one I should change both.

const { fields, append, remove } = useFieldArray({ name: arrayFormName });
const { fields, append } = useFieldArray({ name: arrayFormName });
const [hoveredRowIndex, setHoveredRowIndex] = useState(-1);
const { setValue, getValues } = useFormContext();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using useFieldArray methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to but I failed to do it.

  • fields only return a record of keys/default values. Is there something better than getValues and this ?
  • update would change the whole object at the index instead of just the DELETION_MARK part (I could combine it with a getValues but then it lose its point).
    Do you have a more precise idea ?


modificationLimitsGroups = modificationLimitsGroups.map((formLimitsGroup: OperationalLimitsGroup) => {
return modificationLimitsGroupsForm.map((limitsGroupForm: OperationalLimitsGroupFormInfos) => {
const modificationType: string = LIMIT_SETS_MODIFICATION_TYPE.MODIFY_OR_ADD;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe delete this var and include the value directly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see its the same elsewhere...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK Done.

Mathieu-Deharbe and others added 3 commits September 23, 2025 17:39
Co-authored-by: Florent MILLOT <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Copy link

@Mathieu-Deharbe Mathieu-Deharbe merged commit 9951b26 into main Sep 24, 2025
5 checks passed
@Mathieu-Deharbe Mathieu-Deharbe deleted the rework-limit-modification branch September 24, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants