Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist the order of widgets in the Dashboard #1198

Merged
merged 7 commits into from
Jun 27, 2023

Conversation

krschau
Copy link
Collaborator

@krschau krschau commented Jun 23, 2023

Summary of the pull request

Each time the Dashboard is opened, the widgets may present in a different order. This change saves their order so they will always be displayed in the same order.

References and relevant issues

#463

Detailed description of the pull request / Additional comments

When we get widgets from the host, they don't always come back in the same order. To keep order, this change adds an "position" field to the json that we keep in the widget's CustomState. When we add a new widget, the position will be the next available position. If a widget is edited, it will keep the position it had. If a widget somehow loses its saved position, it will get appended to the end of the list.

Migrating to a version with this change won't be an issue, any existing widgets will be assigned the order they show up in, as if they had "lost" their order as described above.

Validation steps performed

Tested locally.

PR checklist

@krschau krschau force-pushed the user/krschau/save-order branch from 8d94fd8 to 86646fe Compare June 26, 2023 22:33
@EricJohnson327 EricJohnson327 merged commit e961301 into main Jun 27, 2023
@EricJohnson327 EricJohnson327 deleted the user/krschau/save-order branch June 27, 2023 22:21
cinnamon-msft pushed a commit that referenced this pull request Jul 18, 2023
* save widget order

* Use JsonSerializerContext

* unflip flipped inserting

* rename SetPositionCustomState

* Rename to SetPositionCustomStateAsync

* PlaceWidget

* TryAdd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Widgets reorder themselves after relaunching
5 participants