Write down the selection-setter rule and let every view harness use the real dispatcher #248

Closed
opened 2026-10-27 15:03:48 -05:00 by ethan-hann · 1 comment
Owner

The UI-thread crash in #246 came from ActivityScreenViewModel.SelectedRow removing a row from the list whose selection Avalonia was still committing; the fix defers the removal with PostWhenIdle. The suite never caught it because the view harnesses hand out ImmediateUiDispatcher, which runs idle work inline.

  • Add the rule to the "Reach the UI thread" part of .agents/coding-standards/app-mvvm-view-models.md through the han-coding:coding-standard skill: never change a control's items from inside that control's selection setter; defer with PostWhenIdle.
  • ScreenHarness now takes an optional dispatcher. Give ComposedApp and ShellViewHarness the same option, and use the Avalonia dispatcher in the view tests that click list rows, so deferred work runs in the real order.
The UI-thread crash in #246 came from ActivityScreenViewModel.SelectedRow removing a row from the list whose selection Avalonia was still committing; the fix defers the removal with PostWhenIdle. The suite never caught it because the view harnesses hand out ImmediateUiDispatcher, which runs idle work inline. - Add the rule to the "Reach the UI thread" part of .agents/coding-standards/app-mvvm-view-models.md through the han-coding:coding-standard skill: never change a control's items from inside that control's selection setter; defer with PostWhenIdle. - ScreenHarness now takes an optional dispatcher. Give ComposedApp and ShellViewHarness the same option, and use the Avalonia dispatcher in the view tests that click list rows, so deferred work runs in the real order.
ethan-hann added this to the Code Cleanup milestone 2026-10-27 15:03:48 -05:00
Author
Owner

Shipped in SavePoint 0.9.22 (PR #274).

Shipped in [SavePoint 0.9.22](https://git.tortal.tech/ethan-hann/SavePoint/releases/tag/v0.9.22) (PR #274).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ethan-hann/SavePoint#248
No description provided.