Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
beyaz committed Mar 4, 2024
1 parent 8b827ce commit aaefff7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
15 changes: 15 additions & 0 deletions ReactWithDotNet/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ internal static EventSenderInfo GetEventSenderInfo(ReactComponentBase reactCompo

public sealed class Client
{
internal Client Clone()
{
if (TaskList.Count == 0)
{
return new(_reactContext);
}

var cloned = new Client(_reactContext);

cloned.TaskList.AddRange(TaskList);

return cloned;
}


internal readonly List<ClientTask> TaskList = new();
readonly ReactContext _reactContext;

Expand Down
11 changes: 1 addition & 10 deletions ReactWithDotNet/ElementSerializer.ToJsonMap.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System.Collections;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Reflection;
using System.Text.Json.Serialization;

namespace ReactWithDotNet;

Expand Down Expand Up @@ -603,14 +601,7 @@ ReactComponentBase cloneComponent()

if (component._client is not null)
{
if (component._client.TaskList.Count == 0)
{
component._client = new(component.Context);
}
else
{
component._client = ReflectionHelper.DeepCopy(component._client);
}
component._client = component._client.Clone();
}

return component;
Expand Down

0 comments on commit aaefff7

Please sign in to comment.