I’m creating a modify edit pane (in a team tasks tracking app). I’d like to create and visualize some fields with empty values if no teamId is provided (it will be a new team) or existing values taken from a team list (saved in the View Model).
When i try to compose it i noticed (via log prints) that the same component is recomposed 4 times with the same state. This unexpected behavior leads to other strange results. Why does this happen?
Edit team Component
View Model and Ui State classes
Logged the Ui state at every recomposition. I got the same state for the last 3. In the first the fields has been not initialized yet.
2024-06-02 11:31:53.792 5813-5813 NE it.polito.lab4_manageteams D Recomposed EditTeam view with state: EditTeamUi(name=MutableState(value=)@94259335, desc=MutableState(value=)@233321396, members=MutableState(value=[])@215419869, image=MutableState(value=null)@119247698, category=MutableState(value=)@17622563, invitedMembers=MutableState(value=[])@45012768, nameError=MutableState(value=)@213747929, membersError=MutableState(value=)@222007966)
2024-06-02 11:31:54.155 5813-5813 NE it.polito.lab4_manageteams D Recomposed EditTeam view with state: EditTeamUi(name=MutableState(value=Backend Development)@94259335, desc=MutableState(value=Responsible for server-side logic, database management, and API integration.)@233321396, members=MutableState(value=[TeamMember(profileId=0, isAdmin=true, roles=[Developer, Designer]), TeamMember(profileId=1, isAdmin=false, roles=[Tester]), TeamMember(profileId=2, isAdmin=false, roles=[Developer]), TeamMember(profileId=3, isAdmin=true, roles=[Project Manager])])@215419869, image=MutableState(value=null)@119247698, category=MutableState(value=)@17622563, invitedMembers=MutableState(value=[TeamMember(profileId=4, isAdmin=false, roles=[Quality Assurance])])@45012768, nameError=MutableState(value=)@213747929, membersError=MutableState(value=)@222007966)
2024-06-02 11:31:54.822 5813-5813 NE it.polito.lab4_manageteams D Recomposed EditTeam view with state: EditTeamUi(name=MutableState(value=Backend Development)@94259335, desc=MutableState(value=Responsible for server-side logic, database management, and API integration.)@233321396, members=MutableState(value=[TeamMember(profileId=0, isAdmin=true, roles=[Developer, Designer]), TeamMember(profileId=1, isAdmin=false, roles=[Tester]), TeamMember(profileId=2, isAdmin=false, roles=[Developer]), TeamMember(profileId=3, isAdmin=true, roles=[Project Manager])])@215419869, image=MutableState(value=null)@119247698, category=MutableState(value=)@17622563, invitedMembers=MutableState(value=[TeamMember(profileId=4, isAdmin=false, roles=[Quality Assurance])])@45012768, nameError=MutableState(value=)@213747929, membersError=MutableState(value=)@222007966)
2024-06-02 11:31:54.879 5813-5813 NE it.polito.lab4_manageteams D Recomposed EditTeam view with state: EditTeamUi(name=MutableState(value=Backend Development)@94259335, desc=MutableState(value=Responsible for server-side logic, database management, and API integration.)@233321396, members=MutableState(value=[TeamMember(profileId=0, isAdmin=true, roles=[Developer, Designer]), TeamMember(profileId=1, isAdmin=false, roles=[Tester]), TeamMember(profileId=2, isAdmin=false, roles=[Developer]), TeamMember(profileId=3, isAdmin=true, roles=[Project Manager])])@215419869, image=MutableState(value=null)@119247698, category=MutableState(value=)@17622563, invitedMembers=MutableState(value=[TeamMember(profileId=4, isAdmin=false, roles=[Quality Assurance])])@45012768, nameError=MutableState(value=)@213747929, membersError=MutableState(value=)@222007966)
Jacopo Notari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.