diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d3d2d6..b27b024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Version 0.4.2 - 2024-12-03 + +### Fixed + +- Fixes a race modifying state during view update in rare cases + ## Version 0.4.1 - 2024-11-19 ### Fixed diff --git a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift index ee5c93c..304f985 100644 --- a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift +++ b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift @@ -357,7 +357,9 @@ public class MapViewCoordinator: NSObject, MLNMapV direction: mapView.direction, reason: CameraChangeReason(reason)) snapshotCamera = newCamera - parent.camera = newCamera + DispatchQueue.main.async { + self.parent.camera = newCamera + } } /// The MapView's region has changed with a specific reason.