Skip to content

Details dropdown auto-collapses on every scan when Auto Scan is enabled #61

Description

@DysektAI

Summary

When a user has Auto Scan enabled (or scans an item while the main window is open), the "Details" section on the scan result keeps collapsing. If the user opens the Details dropdown, it stays open only until the next scan — then it silently closes, forcing the user to re-open it after every scan.

Expected behavior

Once the user opens Details, it should stay open across scans so they can keep an eye on scan details (selection method, confidence, item info, market data) without it closing on every new scan. Only explicit user actions (clicking the toggle, or deliberately selecting a different item) should close it.

Root cause

The state lives in src/App/Pages/App/Index.razor as the _detailsOpen field:

  • RefreshResult() unconditionally resets _detailsOpen = false:
private void RefreshResult()
{
    _result = MenuVM.LastItemScan.IsSeed ? null : ScanResultAdapter.Map(MenuVM);
    _detailsOpen = false;   // <-- always collapses
    _copiedId = false;
}
  • RefreshResult() is invoked from OnResultChanged, which is wired to MenuVM.PropertyChanged in OnInitialized():
protected override void OnInitialized()
{
    RefreshResult();
    MenuVM.PropertyChanged += OnResultChanged;
    RecentScansStore.Changed += OnRecentScansChanged;
}
  • MenuVM.PropertyChanged fires on every scan enqueue: MenuVM subscribes to the scan orchestrator's PropertyChanged (ModelPropertyChangedOnPropertyChanged()), and RatScannerMain enqueues each scan result with ItemScans.Enqueue(...), which raises PropertyChanged synchronously (see the "Enqueue raises PropertyChanged synchronously" comments in RatScannerMain.cs).

So the chain with Auto Scan on is: scan → enqueue → PropertyChanged → OnResultChangedRefreshResult()_detailsOpen = false — collapsing the Details section on every scan, regardless of whether the user had it open.

Suggested fix direction

Preserve the user's open/closed choice across result refreshes: e.g. don't touch _detailsOpen in RefreshResult() when the refresh is scan-driven, or only collapse when the underlying item identity actually changes and the user hasn't opened Details. SelectRecent (clicking a recent scan) can keep collapsing intentionally since that's a user-initiated item switch.

Environment

  • RatScanner 4.x, Windows x64, Auto Scan enabled

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions