Skip to content

Fix names: replace 500 ms polling timer with push-based debounce - #13206

Open
ivandrofly wants to merge 1 commit into
SubtitleEdit:mainfrom
ivandrofly:refactor/fix-names-push-debounce
Open

Fix names: replace 500 ms polling timer with push-based debounce#13206
ivandrofly wants to merge 1 commit into
SubtitleEdit:mainfrom
ivandrofly:refactor/fix-names-push-debounce

Conversation

@ivandrofly

@ivandrofly ivandrofly commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace the System.Timers.Timer polling loop in FixNamesViewModel with a push-based debounce (CancellationTokenSource + Task.Delay). The old timer fired every 500 ms for the entire lifetime of the window, re-joining the checked names into a string on each tick just to detect whether anything changed — even while the user did nothing. Preview generation is now only scheduled when a checkbox actually changes, and rapid toggles collapse into a single regeneration 500 ms after the last change.
  • Checkbox cell template now uses a two-way IsChecked binding with UpdateSourceTrigger.PropertyChanged and invokes FixNameItemChangedCommand; the space-bar multi-toggle helper also requests a preview.
  • Select all / invert selection / add extra name regenerate the preview directly, removing the _loading / _oldNames / lock bookkeeping the polling approach required.
  • Minor cleanup in TableViewExtras.AddSpaceToggle (parameter rename, lambda simplification).

Test plan

  • Open Tools → Change casing → Fix names with a subtitle containing names; verify the hits preview populates on open
  • Toggle a single name checkbox; verify the preview refreshes ~500 ms later
  • Rapidly toggle several checkboxes; verify only one refresh happens after the last click
  • Use Select all and Invert selection from the context menu; verify the preview updates
  • Select multiple rows and press Space; verify all checkboxes toggle and the preview refreshes
  • Add an extra name; verify it is picked up and the preview updates
  • Toggle a checkbox and immediately close the window; verify no exception from the pending preview

🤖 Generated with Claude Code

@ivandrofly
ivandrofly force-pushed the refactor/fix-names-push-debounce branch 2 times, most recently from 3ef78dd to 112bc3e Compare August 4, 2026 13:28
…Source

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ivandrofly
ivandrofly force-pushed the refactor/fix-names-push-debounce branch from 112bc3e to 95dcbb1 Compare August 4, 2026 13:32
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.

1 participant