Solutionunvalidated
Update the messages state using a functional state updater so it always filters the latest state, and ensure any derived `children`/wrapper state is computed from the current children rather than reused/stored stale values.
976156f1-c532-4e9e-9d67-7898ed306d61
Update the messages state using a functional state updater so it always filters the latest state, and ensure any derived children/wrapper state is computed from the current children rather than reused/stored stale values.