You can work around it by wrapping everything in MainActor.assumeIsolated:
.onPreferenceChange(HeightKey.self) { height in
MainActor.assumeIsolated {
self.height = height
}
}
This should be fine as long as it's being called from the main thread.