When animations or transitions fail it is usually a problem of "identity". If SwiftUI can't figure out, which views belong to an animation because one is destroyed or created. Animation does not work.
See this WWDC Talk for an explanation: https://developer.apple.com/wwdc21/10022
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: