adds Modification reference basic handling#1172
Conversation
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
This comment was marked as low quality.
This comment was marked as low quality.
… dropped Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
… dropped Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/features/network-modification-table/use-modifications-drag-and-drop.tsx (1)
117-129:⚠️ Potential issue | 🟠 Major | ⚡ Quick winShared-modification guard is bypassed for composite source rows
At Line 117-126, the early return for composite sources prevents the shared check at Line 127-129 from running. This allows drops onto shared targets when the source is composite, which breaks the new restriction (“either source or target shared” should be forbidden).
Suggested fix
const isDropForbidden = useCallback( (sourceRow: Row<ComposedModificationMetadata>, targetRow: Row<ComposedModificationMetadata>): boolean => { + // Temporary: shared modifications are not draggable/droppable yet + if (isSharedModification(sourceRow.original) || isSharedModification(targetRow.original)) { + return true; + } + if (isCompositeModification(sourceRow.original)) { const targetDepth = computeTargetDepth(sourceRow, targetRow); return ( (sourceRow.original.maxDepth ?? 0) + targetDepth > MAX_COMPOSITE_NESTING_DEPTH || !!( isCompositeModification(sourceRow.original) && findModificationInTree(targetRow.original.uuid, [sourceRow.original]) ) ); } - // TODO : this is temporary, until drag and drop is done for the shared modifications : - if (isSharedModification(sourceRow.original) || isSharedModification(targetRow.original)) return true; return false; }, [computeTargetDepth] );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/features/network-modification-table/use-modifications-drag-and-drop.tsx` around lines 117 - 129, The shared modification validation check (isSharedModification for both sourceRow and targetRow) is unreachable when the source is a composite modification because the early return statement in the composite modification condition block prevents execution from reaching the shared modification guard. Move the shared modification check to execute before or alongside the composite modification checks, ensuring that restrictions on shared modifications are enforced regardless of whether the source is composite. This will prevent composite source rows from bypassing the shared modification guard that should forbid drops when either source or target is a shared modification.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/features/network-modification-table/use-modifications-drag-and-drop.tsx`:
- Around line 117-129: The shared modification validation check
(isSharedModification for both sourceRow and targetRow) is unreachable when the
source is a composite modification because the early return statement in the
composite modification condition block prevents execution from reaching the
shared modification guard. Move the shared modification check to execute before
or alongside the composite modification checks, ensuring that restrictions on
shared modifications are enforced regardless of whether the source is composite.
This will prevent composite source rows from bypassing the shared modification
guard that should forbid drops when either source or target is a shared
modification.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 81ea9673-e8bd-4824-a756-f46053a2e419
📒 Files selected for processing (6)
src/features/network-modification-table/use-modifications-drag-and-drop.tsxsrc/features/network-modification-table/utils.tssrc/hooks/useModificationLabelComputer.tsxsrc/translations/en/networkModificationsEn.tssrc/translations/fr/networkModificationsFr.tssrc/utils/types/modificationType.ts
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
|



uses #1150