fix(dashboards-ng): preserve auto-positioned widget layout on cancel#1885
Open
chintankavathia wants to merge 1 commit intomainfrom
Open
fix(dashboards-ng): preserve auto-positioned widget layout on cancel#1885chintankavathia 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 introduces a mechanism to capture auto-resolved widget positions when they are first added to the grid, ensuring that a layout cancellation restores the exact positions. Feedback was provided regarding the performance of this implementation, specifically the potential for redundant DOM reads and array iterations during initial load. It was suggested to optimize the check by verifying if coordinates are actually missing and to use the editable() signal instead of the private editableInternal field to align with the project's style guide.
When widgets without explicit x/y are added, GridStack auto-positions them. On cancel, restoring configs with undefined x/y caused GridStack to re-auto-position, potentially producing a different layout. Capture resolved positions from the DOM into persistedWidgetInstances when widgets are first added, so cancel() restores the exact layout.
5cb0689 to
b869511
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.
When widgets without explicit x/y are added, GridStack auto-positions them. On cancel, restoring configs with undefined x/y caused GridStack to re-auto-position, potentially producing a different layout.
Capture resolved positions from the DOM into persistedWidgetInstances when widgets are first added, so cancel() restores the exact layout.
Steps to reproduce:
Documentation.
Examples.
Dashboards Demo.
Playwright report.
Coverage Reports: