From 52f84748e76f602c0cac8175f7d3cf3e76a5b31b Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Tue, 8 Jul 2025 09:54:42 +0200 Subject: Formatting --- Map/Presentation/Complex Components/MapRender/MapRenderView.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Map') diff --git a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift index 896fbd0..9e1f4a2 100644 --- a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift +++ b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift @@ -41,16 +41,15 @@ struct MapRenderView: View { var onDragVertex: (Vertex, CGFloat, CGFloat) -> Void = { _, _, _ in } private func parseMapInBackground() { + parseTask?.cancel() let currentText = document.text parseTask = Task { - // Parse on background thread let parsed = await Task.detached(priority: .userInitiated) { MapParser.parse(content: currentText) }.value - // Calculate smart positions on background thread let positions = await Task.detached(priority: .userInitiated) { var positions: [Int: CGPoint] = [:] @@ -78,7 +77,6 @@ struct MapRenderView: View { return positions }.value - // Update UI on main thread if !Task.isCancelled { await MainActor.run { parsedMap = parsed -- cgit