Flex bug + Peter DeHaan = workaround + wheels in motion
I know, I know—Flex post?! I have been “drinking the Koolaid” these past few months, but this post is for the greater good. I found a bug and it had me panicking for a few solid hours yesterday. I typically would’ve kept my cool, but with a deadline quickly approaching and the fact that I’m still somewhat new to Flex, it was time to sound the alarms.
First, what’s the bug? It occurs when using multiple item renderers with the List component and changing the dataProvider property. The List should recycle the currently used renderers and choose ones that apply to the new data. Instead, the List tries to use the previous renderers on the new content, regardless of whether they match the data.
I resorted to using some internal resources at Adobe and within minutes had a workaround and bug report, courtesy of Peter DeHaan. Simply, reset the itemRendererFunction each time you change the dataProvider property. I know it’s a bit redundant, but it works and is a temporary solution until the fix is in place. If you’re interested in following the bug, you can watch it on JIRA.
