Parameters in Dynamic Pages are Funky

It used to be that parameters in dynamic pages would stick around if the page was refreshed. A refresh happens when a user leaves the app, or the phone goes to sleep, and then the user comes back to SmatThings app and the current page refreshes without parameters.

param.number = 1 (works if just entering page)
after automatic refresh…
param.number = null (Param no longer available)
go back one page, then forward to the original page
param.number = 1 (As normal)

This is ruining the usability of my smart app, causing settings to be set incorrectly. Can anyone help? Pretty sure this is a ST bug, as it used to refresh with current parameters intact in the past.

1 Like

Not having that issue with any of my dynamic pages, an I have one app that has dynamic pages based on dynamic pages…
Post up the dynamic page in question?

Probably worth posting which mobile client you are using.

2 Likes

https://github.com/ethayer/user-lock-manager/blob/master/user-lock-manager.smartapp.groovy

I’m on mobile so I can’t pull up the line number, but it’s the userSettings(params) page.

Like I said, works fine until you close your phone while on the dynamic page. Maybe you have a code sample?

The client I’m using is iphone 1.7.2, I’ll test it on my android device in a sec but I think it behaves the same.

Yes, this seems to be a bug only on iOS. Android app behaves as expected. How do we file a bug report?

Do a log.debug on the params map, I had an issue a month ago where the path to the params key was different between ios and android IE android: params.params.myParam and on ios params.myParam,

I got around that with this bit’o defense, and it was noted as a bug, don’t know if it got fixed or not.

if (params.myParam) {wonk = params.myParam
} else { wonk = params.params.myParam }

I thought I’d do that too, but it turns out params is completely null in the case of a refresh. It seems like the params.params problem has been fixed though.

@mager @Tyler

How do you want developers to report the bugs they find of this type?

Also @Jim whatever bug reporting method is desired should probably be documented in the developer docs.

2 Likes

So from a debug standpoint, I don’t think this a problem with parameters itself rather than the extra refresh on iOS vs android. When resuming the app on andriod, the page does not refresh at all. When resuming on iOS, the page has an extra refresh which doesn’t bring along the original params.

From a developer’s perspective, it’s extremely frustrating to account for different ST Mobile client quirks. We deal with enough device level quirkiness already.

1 Like

For sure. I’m thinking about loading the page parameters into state object as like state.lastParameters so that I can load that up in the case that parameters are missing on a page refresh. Might get me around this particular bug…