Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughIntroduced hierarchical support for network modifications by creating a new Changes
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable sequence diagrams in the walkthrough.Disable the |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/components/graph/menus/network-modifications/network-modification-table/renderers/switch-cell.tsx (1)
55-72:⚠️ Potential issue | 🟠 MajorFlat search won't find sub-modifications in hierarchical state.
toggleModificationActiveusesfindIndexto searcholdModificationsat the root level only. With the new hierarchicalComposedModificationMetadata[]structure, sub-modifications are nested inside their parent'ssubModificationsarray and won't be found by this flat search.When toggling a sub-modification's switch,
modificationToUpdateIndexwill be-1, causing the function to return early without updating local state, even though the API call proceeds.Consider implementing a recursive search or flattening helper to locate modifications at any depth:
🐛 Proposed fix sketch
// Helper to recursively find and update a modification const findAndUpdateModification = ( mods: ComposedModificationMetadata[], uuid: string, updater: (mod: ComposedModificationMetadata) => ComposedModificationMetadata ): ComposedModificationMetadata[] => { return mods.map((mod) => { if (mod.uuid === uuid) { return updater(mod); } if (mod.subModifications?.length) { return { ...mod, subModifications: findAndUpdateModification(mod.subModifications, uuid, updater), }; } return mod; }); };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/graph/menus/network-modifications/network-modification-table/renderers/switch-cell.tsx` around lines 55 - 72, toggleModificationActive fails to find nested sub-modifications because it uses a flat findIndex on oldModifications; implement a recursive updater (e.g., findAndUpdateModification) that walks ComposedModificationMetadata[] and returns a new array with only the target modification's activated toggled, preserving all other items and their subModifications, then call setModifications(old => findAndUpdateModification(old, modificationUuid, mod => ({ ...mod, activated: !mod.activated }))) inside toggleModificationActive and leave the existing updateModification(newStatus) call; ensure the helper recurses into subModifications and returns new objects for any branch that changed.src/components/graph/menus/network-modifications/network-modification-table/use-modifications-drag-and-drop.tsx (1)
51-54:⚠️ Potential issue | 🔴 CriticalIndex mismatch when dragging sub-rows in expanded composite modifications.
When composite modifications are expanded,
table.getRowModel().rowscontains a flattened array including sub-rows. The drag handlers usevirtualRow.index(position in the flattened list) butonRowDragEndapplies these indices directly to the top-levelmodificationsarray. If a sub-row is dragged, the indices will be misaligned—the code will attempt to reorder the wrong top-level modification.Additionally,
isRowDragDisabledis a flat boolean with no depth checking, so sub-rows remain draggable.Solutions:
- Prevent sub-row dragging by passing
depth > 0check toisDragDisabledinmodification-row.tsxline 47- Map flattened indices back to top-level modification indices in
onRowDragEndbefore applying the reorder🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/graph/menus/network-modifications/network-modification-table/use-modifications-drag-and-drop.tsx` around lines 51 - 54, The drag handlers are using flattened virtual row indices but onRowDragEnd reorders the top-level modifications array, causing wrong moves for sub-rows and allowing sub-row drags; update modification-row.tsx to pass a depth check (depth > 0) into the isDragDisabled / isRowDragDisabled prop so any row with depth > 0 is not draggable, and modify the onRowDragEnd handler to map source.index and destination.index from the flattened table.getRowModel().rows back to their parent/top-level modification indices before mutating the modifications array (use rows[source.index].original.parentId or a top-level lookup from rows[...] to resolve the correct modification index) so reorders operate on top-level modification positions only.
🧹 Nitpick comments (5)
src/components/graph/menus/network-modifications/network-modification-table/utils.ts (1)
10-17: Consider defining the interface before the function that uses it.While TypeScript hoisting makes this work, conventional code organization places type/interface definitions before the functions that reference them.
Also,
formatComposedModificationalways initializessubModificationsto an empty array. Based on the context, actual nested modifications forCOMPOSITE_MODIFICATIONtypes would need to be populated elsewhere (e.g., from the API response). Ensure the data source provides populatedsubModificationsfor composite types, or this transformation may need to recursively process nested data.🔧 Suggested reordering
import { NetworkModificationMetadata } from '@gridsuite/commons-ui'; +export interface ComposedModificationMetadata extends NetworkModificationMetadata { + subModifications: ComposedModificationMetadata[]; +} + export const formatComposedModification = ( modifications: NetworkModificationMetadata[] ): ComposedModificationMetadata[] => { return modifications.map((modification) => ({ ...modification, subModifications: [] })); }; - -export interface ComposedModificationMetadata extends NetworkModificationMetadata { - subModifications: ComposedModificationMetadata[]; -}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/graph/menus/network-modifications/network-modification-table/utils.ts` around lines 10 - 17, Move the ComposedModificationMetadata interface declaration above the formatComposedModification function and update formatComposedModification (which currently returns modifications.map(m => ({ ...m, subModifications: [] }))) so it does not always overwrite nested data: if the incoming NetworkModificationMetadata already contains subModifications, preserve them, and if composite types (e.g., type === 'COMPOSITE_MODIFICATION') require recursive construction, recursively map those nested items into ComposedModificationMetadata via the same function; reference the symbols ComposedModificationMetadata, NetworkModificationMetadata and formatComposedModification when making these changes and ensure the function either uses existing subModifications from the API or builds them recursively rather than always setting an empty array.src/components/graph/menus/network-modifications/network-modification-table/network-modifications-table.tsx (2)
66-74: Dual state management may cause synchronization issues.The component maintains two pieces of state:
modifications(from props/parent) andcomposedModification(local derived state). TheuseEffectsyncscomposedModificationwhenmodificationschanges, butsetComposedModificationis passed to child components (via columns) which may update only the local state without propagating changes back to the parent'smodifications.This could lead to state divergence where
composedModificationis modified locally butmodificationsin the parent remains stale until the next external update.Consider either:
- Making the transformation purely derived via
useMemoinstead ofuseState+useEffect- Ensuring all local updates also propagate to
setModifications🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/graph/menus/network-modifications/network-modification-table/network-modifications-table.tsx` around lines 66 - 74, Component holds derived local state composedModification (set via formatComposedModification(modifications)) while also accepting modifications from parent; child updates use setComposedModification only, risking divergence. Fix by making composedModification a pure derived value with useMemo: replace useState/useEffect with const composedModification = useMemo(() => formatComposedModification(modifications), [modifications]) so it always reflects parent props, or alternatively ensure every place that calls setComposedModification (including columns/children) also calls the parent's updater (setModifications) so changes are propagated upstream; update references to setComposedModification, formatComposedModification, and any column handlers accordingly.
35-35: Type mismatch between prop and child component expectations.
handleCellClickis typed as(modification: NetworkModificationMetadata) => voidin the props interface (line 35), butModificationRowexpectshandleCellClick?: (modification: ComposedModificationMetadata) => void. While this compiles due to TypeScript's structural subtyping (contravariance on function parameters), it creates an implicit contract that the parent handler must handle the extended type.Consider updating the prop type to explicitly accept
ComposedModificationMetadatafor clarity and type safety:- handleCellClick: (modification: NetworkModificationMetadata) => void; + handleCellClick: (modification: ComposedModificationMetadata) => void;Also applies to: 189-189
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/graph/menus/network-modifications/network-modification-table/network-modifications-table.tsx` at line 35, The prop type for handleCellClick is too narrow: props define handleCellClick as (modification: NetworkModificationMetadata) => void while child component ModificationRow expects (modification: ComposedModificationMetadata) => void; update the parent prop signature to accept ComposedModificationMetadata (change handleCellClick: (modification: ComposedModificationMetadata) => void) so the handler explicitly accepts the extended type and matches ModificationRow's expectation (also update any other occurrences noted around line 189 to the same ComposedModificationMetadata type).src/components/graph/menus/network-modifications/network-modification-table/styles.ts (1)
175-177: Misleading comment about border suppression logic.The comment states "For the last leaf row of a group" but the actual condition
depth > 0 || isExpandedapplies to all nested rows and expanded parents, not specifically the last leaf. Consider updating the comment to accurately describe the behavior:📝 Proposed comment fix
- // For the last leaf row of a group, only suppress border on the name column (not drag/select) + // Suppress bottom border for nested rows and expanded parents to create visual grouping const suppressedColumns = BORDER_SUPPRESSED_COLUMNS; const suppressBorder = suppressedColumns.has(cell.column.id) && (depth > 0 || isExpanded);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/graph/menus/network-modifications/network-modification-table/styles.ts` around lines 175 - 177, The comment for the border suppression logic is misleading: it says "For the last leaf row of a group" but the condition uses suppressedColumns.has(cell.column.id) && (depth > 0 || isExpanded), which applies to any nested row or any expanded parent, not only the last leaf. Update the comment near suppressedColumns/BORDER_SUPPRESSED_COLUMNS and the suppressBorder variable to accurately describe that border suppression is applied for columns in BORDER_SUPPRESSED_COLUMNS when the row is nested (depth > 0) or the row is expanded (isExpanded), and clarify that this is not limited to last-leaf rows.src/components/graph/menus/network-modifications/network-modification-table/renderers/name-cell.tsx (1)
81-81: Internationalize aria-label for accessibility.The
aria-labelvalues "Collapse" and "Expand" are hardcoded English strings. For consistency with the rest of the application usingreact-intl, consider usingintl.formatMessage.♻️ Proposed fix
- aria-label={row.getIsExpanded() ? 'Collapse' : 'Expand'} + aria-label={intl.formatMessage({ id: row.getIsExpanded() ? 'collapse' : 'expand' })}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/graph/menus/network-modifications/network-modification-table/renderers/name-cell.tsx` at line 81, The aria-label currently uses hardcoded "Collapse"/"Expand"; change it to use react-intl by importing and calling useIntl within the component (or receive an intl prop), then replace aria-label={row.getIsExpanded() ? 'Collapse' : 'Expand'} with aria-label that calls intl.formatMessage for both states (e.g., message IDs like "networkModification.collapse" and "networkModification.expand" with sensible defaultMessage values) so accessibility labels are internationalized while preserving the row.getIsExpanded() logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/components/graph/menus/network-modifications/network-modification-table/renderers/name-cell.tsx`:
- Around line 95-105: The style object returned for the name cell (the branch
that runs when row.getIsExpanded() || depth > 0) currently uses hardcoded
rgba(81,81,81,1) and declares unused theme parameters; update those
borderTop/borderLeft/borderBottom values to use the theme palette (e.g.,
theme.palette.divider or an appropriate theme.palette.grey variant) so borders
adapt to light/dark mode, and remove the unused standalone "(theme: Theme) =>"
parameter if you inline the style function or otherwise ensure the theme
parameter is actually used; locate the renderer in name-cell.tsx around the
conditional that checks row.getIsExpanded() || depth > 0 and replace the
hardcoded color with a theme-derived color and eliminate the unused theme
parameter to fix the ESLint warning.
- Around line 20-24: Remove the unused depth parameter from the
createIndentedCellStyle function signature and body (change from
createIndentedCellStyle(depth: number) to createIndentedCellStyle():
SxProps<Theme>) to eliminate the `@typescript-eslint/no-unused-vars` warning, and
update the call site where createIndentedCellStyle(...) is invoked in this
component to call createIndentedCellStyle() with no arguments; ensure the
function name createIndentedCellStyle and its usages in this file are
consistently updated.
In
`@src/components/graph/menus/network-modifications/network-modification-table/row/modification-row.tsx`:
- Around line 32-35: The computed but unused isLastLeaf variable in
modification-row.tsx (defined using row.depth, row.getParentRow()?.subRows and
row.index) causes an ESLint no-unused-vars warning; remove the entire
declaration of isLastLeaf (and parentSubRows if only used to compute it) or if
you intended to style the last leaf, apply isLastLeaf where needed (e.g., pass
it to the row className/props or conditional rendering in the component) so the
variable is actually used; update any related code that referenced parentSubRows
solely for this computation.
---
Outside diff comments:
In
`@src/components/graph/menus/network-modifications/network-modification-table/renderers/switch-cell.tsx`:
- Around line 55-72: toggleModificationActive fails to find nested
sub-modifications because it uses a flat findIndex on oldModifications;
implement a recursive updater (e.g., findAndUpdateModification) that walks
ComposedModificationMetadata[] and returns a new array with only the target
modification's activated toggled, preserving all other items and their
subModifications, then call setModifications(old =>
findAndUpdateModification(old, modificationUuid, mod => ({ ...mod, activated:
!mod.activated }))) inside toggleModificationActive and leave the existing
updateModification(newStatus) call; ensure the helper recurses into
subModifications and returns new objects for any branch that changed.
In
`@src/components/graph/menus/network-modifications/network-modification-table/use-modifications-drag-and-drop.tsx`:
- Around line 51-54: The drag handlers are using flattened virtual row indices
but onRowDragEnd reorders the top-level modifications array, causing wrong moves
for sub-rows and allowing sub-row drags; update modification-row.tsx to pass a
depth check (depth > 0) into the isDragDisabled / isRowDragDisabled prop so any
row with depth > 0 is not draggable, and modify the onRowDragEnd handler to map
source.index and destination.index from the flattened table.getRowModel().rows
back to their parent/top-level modification indices before mutating the
modifications array (use rows[source.index].original.parentId or a top-level
lookup from rows[...] to resolve the correct modification index) so reorders
operate on top-level modification positions only.
---
Nitpick comments:
In
`@src/components/graph/menus/network-modifications/network-modification-table/network-modifications-table.tsx`:
- Around line 66-74: Component holds derived local state composedModification
(set via formatComposedModification(modifications)) while also accepting
modifications from parent; child updates use setComposedModification only,
risking divergence. Fix by making composedModification a pure derived value with
useMemo: replace useState/useEffect with const composedModification = useMemo(()
=> formatComposedModification(modifications), [modifications]) so it always
reflects parent props, or alternatively ensure every place that calls
setComposedModification (including columns/children) also calls the parent's
updater (setModifications) so changes are propagated upstream; update references
to setComposedModification, formatComposedModification, and any column handlers
accordingly.
- Line 35: The prop type for handleCellClick is too narrow: props define
handleCellClick as (modification: NetworkModificationMetadata) => void while
child component ModificationRow expects (modification:
ComposedModificationMetadata) => void; update the parent prop signature to
accept ComposedModificationMetadata (change handleCellClick: (modification:
ComposedModificationMetadata) => void) so the handler explicitly accepts the
extended type and matches ModificationRow's expectation (also update any other
occurrences noted around line 189 to the same ComposedModificationMetadata
type).
In
`@src/components/graph/menus/network-modifications/network-modification-table/renderers/name-cell.tsx`:
- Line 81: The aria-label currently uses hardcoded "Collapse"/"Expand"; change
it to use react-intl by importing and calling useIntl within the component (or
receive an intl prop), then replace aria-label={row.getIsExpanded() ? 'Collapse'
: 'Expand'} with aria-label that calls intl.formatMessage for both states (e.g.,
message IDs like "networkModification.collapse" and "networkModification.expand"
with sensible defaultMessage values) so accessibility labels are
internationalized while preserving the row.getIsExpanded() logic.
In
`@src/components/graph/menus/network-modifications/network-modification-table/styles.ts`:
- Around line 175-177: The comment for the border suppression logic is
misleading: it says "For the last leaf row of a group" but the condition uses
suppressedColumns.has(cell.column.id) && (depth > 0 || isExpanded), which
applies to any nested row or any expanded parent, not only the last leaf. Update
the comment near suppressedColumns/BORDER_SUPPRESSED_COLUMNS and the
suppressBorder variable to accurately describe that border suppression is
applied for columns in BORDER_SUPPRESSED_COLUMNS when the row is nested (depth >
0) or the row is expanded (isExpanded), and clarify that this is not limited to
last-leaf rows.
In
`@src/components/graph/menus/network-modifications/network-modification-table/utils.ts`:
- Around line 10-17: Move the ComposedModificationMetadata interface declaration
above the formatComposedModification function and update
formatComposedModification (which currently returns modifications.map(m => ({
...m, subModifications: [] }))) so it does not always overwrite nested data: if
the incoming NetworkModificationMetadata already contains subModifications,
preserve them, and if composite types (e.g., type === 'COMPOSITE_MODIFICATION')
require recursive construction, recursively map those nested items into
ComposedModificationMetadata via the same function; reference the symbols
ComposedModificationMetadata, NetworkModificationMetadata and
formatComposedModification when making these changes and ensure the function
either uses existing subModifications from the API or builds them recursively
rather than always setting an empty array.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6dfe2f86-2d8b-4718-9c5e-bde901696e81
📒 Files selected for processing (15)
src/components/graph/menus/network-modifications/network-modification-table/columns-definition.tsxsrc/components/graph/menus/network-modifications/network-modification-table/network-modifications-table.tsxsrc/components/graph/menus/network-modifications/network-modification-table/renderers/depth-box.tsxsrc/components/graph/menus/network-modifications/network-modification-table/renderers/description-cell.tsxsrc/components/graph/menus/network-modifications/network-modification-table/renderers/name-cell.tsxsrc/components/graph/menus/network-modifications/network-modification-table/renderers/root-network-chip-cell.tsxsrc/components/graph/menus/network-modifications/network-modification-table/renderers/select-cell.tsxsrc/components/graph/menus/network-modifications/network-modification-table/renderers/select-header-cell.tsxsrc/components/graph/menus/network-modifications/network-modification-table/renderers/switch-cell.tsxsrc/components/graph/menus/network-modifications/network-modification-table/row/drag-row-clone.tsxsrc/components/graph/menus/network-modifications/network-modification-table/row/modification-row.tsxsrc/components/graph/menus/network-modifications/network-modification-table/styles.tssrc/components/graph/menus/network-modifications/network-modification-table/use-modifications-drag-and-drop.tsxsrc/components/graph/menus/network-modifications/network-modification-table/utils.tssrc/services/study/network-modifications.ts
| const createIndentedCellStyle = (depth: number): SxProps<Theme> => ({ | ||
| display: 'flex', | ||
| alignItems: 'stretch', | ||
| gap: 0, | ||
| }); |
There was a problem hiding this comment.
Remove unused depth parameter to fix ESLint warning.
The depth parameter is defined but never used in the function body. This triggers the @typescript-eslint/no-unused-vars warning flagged in CI.
🔧 Proposed fix
-const createIndentedCellStyle = (depth: number): SxProps<Theme> => ({
+const createIndentedCellStyle = (): SxProps<Theme> => ({
display: 'flex',
alignItems: 'stretch',
gap: 0,
});Also update the call site at line 57:
- createIndentedCellStyle(depth),
+ createIndentedCellStyle(),🧰 Tools
🪛 GitHub Check: build / build
[warning] 20-20:
'depth' is defined but never used. Allowed unused args must match /^_/u
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/components/graph/menus/network-modifications/network-modification-table/renderers/name-cell.tsx`
around lines 20 - 24, Remove the unused depth parameter from the
createIndentedCellStyle function signature and body (change from
createIndentedCellStyle(depth: number) to createIndentedCellStyle():
SxProps<Theme>) to eliminate the `@typescript-eslint/no-unused-vars` warning, and
update the call site where createIndentedCellStyle(...) is invoked in this
component to call createIndentedCellStyle() with no arguments; ensure the
function name createIndentedCellStyle and its usages in this file are
consistently updated.
| row.getIsExpanded() || depth > 0 | ||
| ? { | ||
| alignSelf: 'stretch', | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| flex: 1, | ||
| borderBottom: (theme: Theme) => `1px solid rgba(81, 81, 81, 1)`, | ||
| borderLeft: (theme: Theme) => `1px solid rgba(81, 81, 81, 1)`, | ||
| borderTop: (theme: Theme) => `1px solid rgba(81, 81, 81, 1)`, | ||
| } | ||
| : {} |
There was a problem hiding this comment.
Use theme palette instead of hardcoded color; remove unused theme parameters.
The border colors use hardcoded rgba(81, 81, 81, 1) which won't adapt to light/dark mode themes. The theme parameters are declared but unused, triggering ESLint warnings.
Either use the theme parameter for the border color or remove it:
🔧 Proposed fix using theme
? {
alignSelf: 'stretch',
display: 'flex',
alignItems: 'center',
flex: 1,
- borderBottom: (theme: Theme) => `1px solid rgba(81, 81, 81, 1)`,
- borderLeft: (theme: Theme) => `1px solid rgba(81, 81, 81, 1)`,
- borderTop: (theme: Theme) => `1px solid rgba(81, 81, 81, 1)`,
+ borderBottom: (theme: Theme) => `1px solid ${theme.palette.divider}`,
+ borderLeft: (theme: Theme) => `1px solid ${theme.palette.divider}`,
+ borderTop: (theme: Theme) => `1px solid ${theme.palette.divider}`,
}🧰 Tools
🪛 GitHub Actions: CI
[warning] 101-101: ESLint (@typescript-eslint/no-unused-vars): 'theme' is defined but never used. Allowed unused args must match /^_/u
[warning] 102-102: ESLint (@typescript-eslint/no-unused-vars): 'theme' is defined but never used. Allowed unused args must match /^_/u
[warning] 103-103: ESLint (@typescript-eslint/no-unused-vars): 'theme' is defined but never used. Allowed unused args must match /^_/u
🪛 GitHub Check: build / build
[warning] 103-103:
'theme' is defined but never used. Allowed unused args must match /^_/u
[warning] 102-102:
'theme' is defined but never used. Allowed unused args must match /^_/u
[warning] 101-101:
'theme' is defined but never used. Allowed unused args must match /^_/u
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/components/graph/menus/network-modifications/network-modification-table/renderers/name-cell.tsx`
around lines 95 - 105, The style object returned for the name cell (the branch
that runs when row.getIsExpanded() || depth > 0) currently uses hardcoded
rgba(81,81,81,1) and declares unused theme parameters; update those
borderTop/borderLeft/borderBottom values to use the theme palette (e.g.,
theme.palette.divider or an appropriate theme.palette.grey variant) so borders
adapt to light/dark mode, and remove the unused standalone "(theme: Theme) =>"
parameter if you inline the style function or otherwise ensure the theme
parameter is actually used; locate the renderer in name-cell.tsx around the
conditional that checks row.getIsExpanded() || depth > 0 and replace the
hardcoded color with a theme-derived color and eliminate the unused theme
parameter to fix the ESLint warning.
| // Last leaf: depth > 0 and this row is the last child of its parent | ||
| const parentSubRows = row.getParentRow()?.subRows; | ||
| const isLastLeaf = | ||
| row.depth > 0 && !!parentSubRows && row.index === parentSubRows[parentSubRows.length - 1].index; |
There was a problem hiding this comment.
Remove unused isLastLeaf variable to fix ESLint warning.
isLastLeaf is computed but never used, which triggers the @typescript-eslint/no-unused-vars ESLint warning flagged in the CI pipeline. Either use this variable for its intended purpose (e.g., styling the last leaf row differently) or remove it.
🔧 Proposed fix to remove unused code
const isExpanded = row.getIsExpanded() && !!row.subRows?.length;
- // Last leaf: depth > 0 and this row is the last child of its parent
- const parentSubRows = row.getParentRow()?.subRows;
- const isLastLeaf =
- row.depth > 0 && !!parentSubRows && row.index === parentSubRows[parentSubRows.length - 1].index;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Last leaf: depth > 0 and this row is the last child of its parent | |
| const parentSubRows = row.getParentRow()?.subRows; | |
| const isLastLeaf = | |
| row.depth > 0 && !!parentSubRows && row.index === parentSubRows[parentSubRows.length - 1].index; |
🧰 Tools
🪛 GitHub Actions: CI
[warning] 34-34: ESLint (@typescript-eslint/no-unused-vars): 'isLastLeaf' is assigned a value but never used
🪛 GitHub Check: build / build
[warning] 34-34:
'isLastLeaf' is assigned a value but never used
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/components/graph/menus/network-modifications/network-modification-table/row/modification-row.tsx`
around lines 32 - 35, The computed but unused isLastLeaf variable in
modification-row.tsx (defined using row.depth, row.getParentRow()?.subRows and
row.index) causes an ESLint no-unused-vars warning; remove the entire
declaration of isLastLeaf (and parentSubRows if only used to compute it) or if
you intended to style the last leaf, apply isLastLeaf where needed (e.g., pass
it to the row className/props or conditional rendering in the component) so the
variable is actually used; update any related code that referenced parentSubRows
solely for this computation.
PR Summary