Skip to content

Commit bbe381f

Browse files
author
Arnaud Leclerc
committed
Affect JSRuntime to datasource before invoking it
1 parent 048cf8e commit bbe381f

File tree

1 file changed

+8
-6
lines changed
  • src/AzureMapsControl.Components/Map

1 file changed

+8
-6
lines changed

src/AzureMapsControl.Components/Map/Map.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,26 +260,28 @@ public async ValueTask AddSourceAsync<TSource>(TSource source) where TSource : S
260260

261261
if (source is DataSource dataSource)
262262
{
263+
dataSource.Logger = _logger;
264+
dataSource.JSRuntime = _jsRuntime;
265+
263266
await _jsRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.Core.AddSource.ToCoreNamespace(),
264267
source.Id,
265268
source.GetSourceOptions(),
266269
source.SourceType.ToString(),
267270
dataSource.EventActivationFlags?.EnabledEvents,
268271
DotNetObjectReference.Create(_dataSourceEventInvokeHelper));
269-
dataSource.Logger = _logger;
270-
dataSource.JSRuntime = _jsRuntime;
271272
}
272273
else
273274
{
274-
await _jsRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.Core.AddSource.ToCoreNamespace(),
275-
source.Id,
276-
source.GetSourceOptions(),
277-
source.SourceType.ToString());
278275
if (source is GriddedDataSource griddedDataSource)
279276
{
280277
griddedDataSource.Logger = _logger;
281278
griddedDataSource.JSRuntime = _jsRuntime;
282279
}
280+
281+
await _jsRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.Core.AddSource.ToCoreNamespace(),
282+
source.Id,
283+
source.GetSourceOptions(),
284+
source.SourceType.ToString());
283285
}
284286
}
285287

0 commit comments

Comments
 (0)