I made a very simple app to reproduce the behavior that I believe is the root cause of something people were reporting in Hubitat Package Manager.
definition(
name: "SubmitOnChange Test",
namespace: "dcm.test",
author: "Dominick Meglio",
description: "Reproduces a bug",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
preferences {
page(name: "page1", title: "Page1")
page(name: "page2", title: "Page2" )
}
def page1() {
def options = [1,2,3,4,5,6,7,8,9,10]
return dynamicPage(name: "page1", title: "Page 1", nextPage:"page2", uninstall:false, install: false) {
section {
input("opt", "enum", title: "Options", description: "Options", options: options, multiple: true, required: true, submitOnChange: true)
if (opt != null) {
log.debug "before pause execution"
pauseExecution(10000) // something to take a while
log.debug "after pause execution"
}
}
}
}
def page2() {
dynamicPage(name: "page2", title: "Page2", install: true, uninstall: false) {
section {
paragraph "The value of opt is: " + opt
}
}
}
Create a new user app with that code. Ensure the live log is running when you go through the preference pages. This testing was done in Chrome 81, unsure if it affects other browsers.
1.) Open live log
2.) Click add new user app and choose SubmitOnChange Test
3.) While on the first page, select a few options in the dropdown
4.) Do NOT click out of the dropdown such that the dropdown with the checkmarks remains open
5.) Click the Next button
6.) Observe that you immediately move to page 2
7.) Look in the live logs, you will see "before pause execution" is logged, but the "after pause execution" is not. Wait the 10 seconds and you will see it occurs AFTER you're already on page 2
1.) Repeat steps 1-4 except this time click OUT of the dropdown
2.) Notice that a spinner appears in the top right corner of the screen
3.) Attempt to click the next button
4.) Observe you can NOT click the next button until the spinner stops and the "After pause execution" log message appears
What I believe is happening here is, while the dropdown is open on an enum input(didn't test if it affects non-multiple fields), the Next button is NOT disabled when it SHOULD be if the input has submitOnChange = true.
In my HPM app this is leading to a situation where people click too quickly and the logic I have never finished executing causing the app to be in a bad state and displaying a blank page.
@bravenel @chuck.schwer - not sure which one of you handles these kinds of issues.