Consume network-modification-table renderers from commons-ui#3945
Open
flomillot wants to merge 9 commits into
Open
Consume network-modification-table renderers from commons-ui#3945flomillot wants to merge 9 commits into
flomillot wants to merge 9 commits into
Conversation
Stop unmounting cells (and resetting their local state like SwitchCell's modificationActivated) on every columns rebuild by hoisting all cell/header renderers to module scope and routing dynamic values through react-table meta instead of closure capture. - Hoist renderers to a new cell-renderers.tsx (DragHandle, Select, Name, Description, Switch, RootNetwork) - Replace createBaseColumns factory with a static BASE_COLUMNS constant - Build the columns array directly in the editor and pass it as a `columns` prop instead of a createAllColumns callback - Augment react-table TableMeta/ColumnMeta to type the meta channel - Drop the optimistic global update from SwitchCell; the row state is refreshed by the server notification, and a local useState handles the immediate checkbox feedback with rollback on error - Replace useState/useEffect in useIsAnyNodeBuilding with a direct selector - Remove the now-broken inline debounce around handleCellClick Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
- Clarify the importance of stable references for cell/header renderers. - Update explanatory comments about renderers' scope and usage in react-table. Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
The per-row cells, the cell-renderers adapter, the two services (setModificationMetadata, updateModificationStatusByRootNetwork) and the @tanstack/react-table module augmentation that they relied on have moved to commons-ui. Local files are deleted and createColumns now imports the renderers from commons-ui. createRootNetworksColumns is simplified: it only needs the root-networks list since the rest of the per-column meta (rootNetwork, modificationsToExclude, isCurrentRootNetwork, currentRootNetworkTag) is now derived from TableMeta. The node editor passes studyUuid, currentNodeId, currentRootNetworkUuid, rootNetworks, modificationsToExclude, setModificationsToExclude and a combined isDisabled (isAnyNodeBuilding || mapDataLoading) to NetworkModificationsTable. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
This reverts commit 6c47b85.
The per-row cells, the cell-renderers adapter, the two services (setModificationMetadata, updateModificationStatusByRootNetwork) and the @tanstack/react-table module augmentation that they relied on have moved to commons-ui. Local files are deleted and createColumns now imports the renderers from commons-ui. createRootNetworksColumns is simplified: it only needs the root-networks list since the rest of the per-column meta (rootNetwork, modificationsToExclude, isCurrentRootNetwork, currentRootNetworkTag) is now derived from TableMeta. The node editor passes studyUuid, currentNodeId, currentRootNetworkUuid, rootNetworks, modificationsToExclude, setModificationsToExclude and a combined isDisabled (isAnyNodeBuilding || mapDataLoading) to NetworkModificationsTable. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
📝 WalkthroughWalkthroughThis PR consolidates network modification table cell renderers into a shared commons-ui library, removing local inline editing capabilities and simplifying the column definition API. The changes affect column definitions, component integration, service exports, and type augmentations. ChangesNetwork Modification Table Refactoring
Suggested Reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Base automatically changed from
perf/network-modifications-table-rendering
to
main
May 19, 2026 16:44
…ification-renderers Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
Composite name editing is now self-contained in commons-ui's NameCell, so the updateModification/handleCellEdit handlers and the onEditNameCell prop are no longer needed. Adds the networkModificationRenamingError message displayed by the cell on failure. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
createBaseColumns takes the name column's onChange callback; the node editor supplies handleNameChange, which persists the rename via setModificationMetadata. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The per-row cells, the
cell-renderersadapter, the two services (setModificationMetadata,updateModificationStatusByRootNetwork) and the@tanstack/react-tablemodule augmentation they relied on have moved to commons-ui.createColumnsnow imports the renderers from@gridsuite/commons-ui.createRootNetworksColumnsis simplified: it only needs the root-networks list since the rest of the per-column meta (rootNetwork,modificationsToExclude,isCurrentRootNetwork,currentRootNetworkTag) is now derived fromTableMeta.studyUuid,currentNodeId,currentRootNetworkUuid,rootNetworks,modificationsToExclude,setModificationsToExcludeand a combinedisDisabled(isAnyNodeBuilding || mapDataLoading) toNetworkModificationsTable.gridstudy-app/src/module-tanstack.d.tsis removed; the augmentation lives in commons-ui.Companion PR on commons-ui: https://github.com/gridsuite/commons-ui/pulls?q=is%3Apr+head%3Aperf%2Fmove-network-modification-renderers