Eval placeholder args in show update method (from #1702) #1750
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.
This PR reconciles a gap caused by #1557 which added support for updating a running show, and #1702 which added support for dynamic
speed
values in shows.The change by @cobra18t in #1702 changed the expected type of the
speed
parameter from a float to a PlaceholderTemplate, which caused a crash in the update method from #1557 that was not expecting a placeholder object.The resolution here is tricky because in a show, once the template is evaluated it's the resulting value that's saved to the show, not the placeholder template—otherwise the template would be re-evaluated every step of the show, costing overhead. This complicates the update call, however, which that compares the two values prior to generating the updated config to avoid rewriting a show that hasn't changed. Since the incoming value is a placeholder template and the current value is a float, the comparison is not supported.
The fix in this PR is to evaluate the new speed prior to the update call, and to remove the value comparison. The downside is that a call to update speed will always generate a new show config even if the speed is unchanged, but the upside is that update calls work with placeholder templates instead of crashing.