Hi, when I have two instances of a composable with...
# compose
c
Hi, when I have two instances of a composable with FilledTextField, I'm getting this error:
Copy code
java.lang.IllegalArgumentException: Key -1277534736 was already registered. Please call unregister before registering again
        at androidx.ui.savedinstancestate.UiSavedStateRegistryImpl.registerProvider(UiSavedStateRegistry.kt:96)
        at androidx.ui.savedinstancestate.ValueProvider.updateAndReturnValue(RememberSavedInstanceState.kt:103)
        at androidx.ui.savedinstancestate.RememberSavedInstanceStateKt.rememberSavedInstanceState(RememberSavedInstanceState.kt:68)
Any thoughts? Thanks 🙂
c
hey, so the FilledTextField component is affected by that and I would need to duplicate FilledTextField and add the work around until it's fixed?
a
no, you don't need to duplicate it. you have for loop somewhere and you need to add
key(index) {}
inside the for loop. we will make it more automated in the future. if it is still not clear I can help if you share a bit of your code
c
Oh thanks it's working now 😄 I was using a "u"id associated with the object in the for loop but I was sillily using a new random object with the same seed for each id 🙃 Would you recommend it is still better to use the for loop indices ?
a
yes, indices are better, if you don't have anything other unique
in next releases it will be working automatically as if you used indices
c
ooo great work 😄