Seeing a strange, rare, issue after updating an app to 4.6. I can't seem to
reproduce it in a dev environment, so I'll list out my issue and setup to see
if it sounds familiar to anyone.
The problem:
Visual components seem to occasionally "forget" the objects they're bound to.
For instance, I have something like this:
<s:DropDownList
id="cmbMonth"
dataProvider="{model.months}"
selectedItem="@{model.selectedMonth}"
/>
<s:Label text="{model.selectedMonth}" />
When the problem occurs, the "selectedMonth" in the label component is correct,
say, February. But the DropDownList will display a blank. Even though the
DropDownList contains all the months, meaning models.months is bound correctly.
I tried adding:
requireSelection="true"
The addition changed the behavior. No more blanks! But now, instead of
blanks, selectedMonth is showing something random like "May".
Background:
App has been in production in various versions of Flex 3 for two years without
ever seeing this. Upgrading to Flex 4 and swapping out some Halo components
with equivalent Spark ones, users, myself included, began noticing this
phenomenon. I cannot seem to reproduce it in a reliable fashion. But I've
gotten some feedback based on some attempted fixes pushed out to users.
Troubleshooting so far:
Since it normally works, there's no super-obvious things missing, like an
uninitialized pointer, missing "Bindable" tag, accidental = assignment instead
of == comparison, etc.
Also, we know the variable references are pointing to the correct place.
model.selectedMonth is showing up fine for a label just underneath the
dropdown. model.months is being referenced just fine by the dropdown itself.
It's just the display of model.selectedMonth in the dropdown. Upon saving, the
model.month property correctly propagates itself to the DB, even when the
dropdown is displaying the wrong value. Switching between one-way and two-way
bindings don't seem to make a difference either. I noted above that I tried
forcing requireSelection="true", which does prevent the DropDownList from being
blanked-out, but doesn't force it to stay on the correct value.
I thought it might be related to just the DropDownList component, but the
problem is also occurring on s:TextInput's text property. Seems like when it
happens with the TextInput component (showing a blank value), it's doing so for
all the TextInput components. I'm not so sure if it's happening for all
DropDownList elements, though.
App setup:
I have an mx:ViewStack attached to hide/show effects with two containers inside
(loggedOff/loggedOn), and a TabNavigator within that. I think the problems are
only occurring after switching between states for the ViewStack. So after the
components are hidden and come back. I remembered back to the Flex 2 ViewStack
issue where bindings didn't refresh, and added the old workaround to my code:
change="executeBindings(true)"
This didn't fix it. Anything else I can look at or try? Anyone else
experience this before? Any chance it's related to the framework instead of my
code?