Fix RunCommand Action Failing After Page Changes#42
Open
designgears wants to merge 1 commit intoStreamController:mainfrom
Open
Fix RunCommand Action Failing After Page Changes#42designgears wants to merge 1 commit intoStreamController:mainfrom
designgears wants to merge 1 commit intoStreamController:mainfrom
Conversation
…fter page changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: StreamController/StreamController#475
Summary
Fixes a bug where the "Run Command" action stops working after the first button press when used together with "Change Page" actions on the same button.
Bug Description
When a button has both "Change Page" and "Run Command" actions:
Root Cause
The RunCommand action has a
registered_downflag (line 24) used as a workaround to prevent duplicate execution. However, this flag wasn't being reset when the page changed, causing subsequent executions to be blocked.Sequence of events:
registered_downbecomesTrue, then resets toFalseon key up ✅registered_downis stillTruefrom previous page, action returns early ❌Solution
Reset the
registered_downflag in theon_ready()method, which is called when actions are re-initialized after page changes.Changes Made
File:
actions/RunCommand/RunCommand.pyLine: 30 (added)
Why This Works
DeckController.load_page()is called, it executesactive_page.initialize_actions()on_ready()for all actions on the new pageregistered_down = Falseinon_ready(), the action can execute properly after page changesTesting
Created and verified with test script that demonstrates:
Steps to Reproduce (Before Fix)
/tmp/test.shExpected Behavior (After Fix)
Both actions execute consistently on every button press.
Impact
Related Issues
Files Changed
actions/RunCommand/RunCommand.py(1 line added)Testing Commands