Skip to content

fix(niriDS): serialize rapid output toggles - #47

Merged
hthienloc merged 2 commits into
hthienloc:mainfrom
erickosanchezj:fix/niriDS-rapid-toggle-race
Nov 20, 2026
Merged

hthienloc merged 2 commits into
hthienloc:mainfrom
erickosanchezj:fix/niriDS-rapid-toggle-race

Conversation

@erickosanchezj

Copy link
Copy Markdown
Contributor

What

Serialize toggle commands per output and derive each click from the pending requested state until a fresh output snapshot confirms it. Failed commands restore the last successfully applied state, and disconnects discard queued work. Each process request has its own callback/debounce slot.

Why

Two clicks before a command or its asynchronous refresh finishes can both read the same display.disabled value and send off twice. This follow-up to #46 preserves the latest requested state across that interval.

Addresses the rapid-click finding. The native-refresh method and direct-query compatibility fallback are unchanged.

How tested

  • 26 local deterministic mocked cases across native refresh and the compatibility fallback: clicks before launch, during execution and before refresh; bursts of 3–6 clicks; stale snapshots; independent outputs; failed commands; disconnect/reconnect callbacks; stale delegate data.
  • Qt 6 qmllint niriDS/*.qml niriDS/shared/*.qml: exit 0, with no new diagnostic messages or counts relative to the previous revision.
  • python3 scripts/check_unused_imports.py niriDS: passes with installed Dux sources available to symbol discovery.
  • python3 scripts/refactor_dcommon.py --check --requires-dms ">=2.0.0" and git diff --check: pass.

This follow-up was tested with mocked commands and refresh responses; no live monitor switching was performed.

Track the requested state for each output until refreshed data confirms it, and serialize commands so repeated clicks preserve the latest intent. Isolate process callbacks and discard pending work when an output disconnects.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 286a2191-b813-460a-8509-6765d5b8a0fb
Commits

Reviewing files that changed from the base of the PR and between 011c133 and 8b74a26.

Files selected for processing: 1

  • niriDS/NiriDisplaySettingsService.qml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@erickosanchezj

Copy link
Copy Markdown
Contributor Author

Hey @hthienloc submitted this one as I saw the comments on #46 but let me know if we just close this one out, thanks for the quick merge

@hthienloc
hthienloc merged commit c37dabd into hthienloc:main Nov 20, 2026
1 check passed
@hthienloc

Copy link
Copy Markdown
Owner

I added a small commit to reset _pendingToggles in apply() and enableInternalDisplay(). Appreciate the contribution 😊

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.

2 participants