refactor(dashboards-ng): make editable a single source of truth#1892
Open
chintankavathia wants to merge 1 commit intomainfrom
Open
refactor(dashboards-ng): make editable a single source of truth#1892chintankavathia wants to merge 1 commit intomainfrom
chintankavathia wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the dashboard grid's edit state management by replacing the BehaviorSubject in SiGridService and the internal editableInternal property with Angular signals and model inputs. While this modernizes the state handling, several regressions were identified where guards in the edit() and cancel() methods prevent necessary state transitions when triggered via input bindings. Additionally, feedback was provided to avoid any types in error handlers per the style guide and to ensure setupEditable is not called prematurely during the initial change detection cycle in SiWidgetHostComponent.
db919ab to
a2d3a80
Compare
a2d3a80 to
e261eb1
Compare
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.
Consolidates the dashboard grid's editable state by removing the duplicated
editableInternalproperty inSiGridComponentand theeditable$BehaviorSubject inSiGridService. The editable model signal onSiGridComponentis now the sole owner of the editable state.In
SiWidgetHostComponent, the editable state is now passed as a regular input() binding instead of being consumed via an async observable from the grid service.Why
Previously, the editable state was tracked in three places:
SiGridComponentSiGridServiceThis made the code harder to reason about—edit(), save(), and cancel() had to keep all three in sync, and
SiWidgetHostComponentsubscribed to the service observable rather than receiving the value directly from its parent.Documentation.
Examples.
Dashboards Demo.
Playwright report.
Coverage Reports: