diff --git a/src/AzureMapsControl.Components/Drawing/DrawingManager.cs b/src/AzureMapsControl.Components/Drawing/DrawingManager.cs
index 1fe6879..f94b719 100644
--- a/src/AzureMapsControl.Components/Drawing/DrawingManager.cs
+++ b/src/AzureMapsControl.Components/Drawing/DrawingManager.cs
@@ -20,11 +20,6 @@ public sealed class DrawingManager
internal ILogger Logger { get; set; }
public bool Disposed { get; private set; }
- ///
- /// List of shapes added to the data source
- ///
- private List _sourceShapes;
-
///
/// Add shapes to the drawing manager data source
///
@@ -42,11 +37,6 @@ public async ValueTask AddShapesAsync(IEnumerable shapes)
EnsureJsRuntimeExists();
EnsureNotDisposed();
- if (_sourceShapes == null)
- {
- _sourceShapes = new List();
- }
-
var lineStrings = shapes.OfType>();
if (lineStrings.Any())
{
@@ -95,8 +85,6 @@ public async ValueTask AddShapesAsync(IEnumerable shapes)
Logger?.LogAzureMapsControlDebug(AzureMapLogEvent.Source_AddAsync, $"{routePoints.Count()} route points will be added");
await JSRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.Source.AddShapes.ToDrawingNamespace(), routePoints);
}
-
- _sourceShapes.AddRange(shapes);
}
///
@@ -112,7 +100,6 @@ public async ValueTask ClearAsync()
EnsureJsRuntimeExists();
EnsureNotDisposed();
- _sourceShapes = null;
await JSRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.Source.Clear.ToDrawingNamespace());
}
diff --git a/tests/AzureMapsControl.Components.Tests/Drawing/DrawingManager.cs b/tests/AzureMapsControl.Components.Tests/Drawing/DrawingManager.cs
index f6eab30..3eaccf9 100644
--- a/tests/AzureMapsControl.Components.Tests/Drawing/DrawingManager.cs
+++ b/tests/AzureMapsControl.Components.Tests/Drawing/DrawingManager.cs
@@ -2,7 +2,6 @@
{
using System.Collections.Generic;
using System.Linq;
- using System.Reflection;
using System.Threading.Tasks;
using AzureMapsControl.Components.Atlas;
@@ -176,13 +175,6 @@ public async Task Should_AccumulateShapes_InInternalState_Async()
await drawingManager.AddShapesAsync(secondBatch);
await drawingManager.AddShapesAsync(thirdBatch);
- // Verify internal state accumulates all shapes
- var sourceShapes = GetInternalSourceShapes(drawingManager);
- Assert.Equal(3, sourceShapes.Count);
- Assert.Contains(firstBatch[0], sourceShapes);
- Assert.Contains(secondBatch[0], sourceShapes);
- Assert.Contains(thirdBatch[0], sourceShapes);
-
// Verify correct number of JS calls
_jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(
Constants.JsConstants.Methods.Source.AddShapes.ToDrawingNamespace(),
@@ -195,22 +187,12 @@ public async Task Should_ClearInternalState_WhenCleared_Async()
var drawingManager = CreateInitializedDrawingManager();
var shapes = new List { new Shape(new Point()) };
- // Add shapes to initialize and populate internal state
+ // Add shapes then clear
await drawingManager.AddShapesAsync(shapes);
- var sourceShapes = GetInternalSourceShapes(drawingManager);
- Assert.NotNull(sourceShapes);
- Assert.Single(sourceShapes);
-
- // Clear should reset internal state
await drawingManager.ClearAsync();
- sourceShapes = GetInternalSourceShapes(drawingManager);
- Assert.Null(sourceShapes);
- // Adding again should reinitialize state
+ // Adding again should work without errors
await drawingManager.AddShapesAsync(shapes);
- sourceShapes = GetInternalSourceShapes(drawingManager);
- Assert.NotNull(sourceShapes);
- Assert.Single(sourceShapes);
_jsRuntimeMock.Verify(runtime => runtime.InvokeVoidAsync(Constants.JsConstants.Methods.Source.AddShapes.ToDrawingNamespace(), It.IsAny