Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Conversation

@krschau
Copy link
Collaborator

@krschau krschau commented Mar 6, 2024

Summary of the pull request

There is a bug where Dashboard can lose the order of widgets if some widgets are deleted (so the PinnedWidget count goes down, but the saved position index of the last widget stays the same) and then widgets are added (with a saved position index now less than or equal to the saved position index of the last widget(s). This change prevents this scenario by listening for when a widget is deleted, and then updating the saved position index of any subsequent widgets whose positions have now moved up in the list.

We stop listening to this event during drag and drop, since drop removes (and re-adds) a widget and takes care of re-numbering any affected widgets already.

References and relevant issues

Detailed description of the pull request / Additional comments

Validation steps performed

Tested locally.

PR checklist

{
if (e.OldItems != null)
{
await _pinnedWidgetsLock.WaitAsync();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this lock also be used in other methods where the shared resources are accessed (read/write)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a to-do in the code with a work item for doing better concurrency, #1215. TBH I'm tempted to do it separately.

@krschau krschau merged commit 1fbd2c1 into main Mar 11, 2024
@krschau krschau deleted the user/krschau/widgetpositions branch March 11, 2024 21:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard can lose order on next launch when widgets are deleted and added

5 participants