Ignitor fixups (#21198)
* Ignitor fixups * Do not throw if an ElementReferenceCapture node is encountered. * Allow configuring the HubConnectionBuilder * Make useful API public
This commit is contained in:
parent
b73b2027cc
commit
9cecd089e4
|
|
@ -333,11 +333,12 @@ namespace Ignitor
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> ConnectAsync(Uri uri, bool connectAutomatically = true)
|
public async Task<bool> ConnectAsync(Uri uri, bool connectAutomatically = true, Action<HubConnectionBuilder, Uri>? configure = null)
|
||||||
{
|
{
|
||||||
var builder = new HubConnectionBuilder();
|
var builder = new HubConnectionBuilder();
|
||||||
builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, IgnitorMessagePackHubProtocol>());
|
builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, IgnitorMessagePackHubProtocol>());
|
||||||
builder.WithUrl(GetHubUrl(uri));
|
var hubUrl = GetHubUrl(uri);
|
||||||
|
builder.WithUrl(hubUrl);
|
||||||
builder.ConfigureLogging(l =>
|
builder.ConfigureLogging(l =>
|
||||||
{
|
{
|
||||||
l.SetMinimumLevel(LogLevel.Trace);
|
l.SetMinimumLevel(LogLevel.Trace);
|
||||||
|
|
@ -347,6 +348,8 @@ namespace Ignitor
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
configure?.Invoke(builder, hubUrl);
|
||||||
|
|
||||||
_hubConnection = builder.Build();
|
_hubConnection = builder.Build();
|
||||||
|
|
||||||
HubConnection.On<int, string>("JS.AttachComponent", OnAttachComponent);
|
HubConnection.On<int, string>("JS.AttachComponent", OnAttachComponent);
|
||||||
|
|
|
||||||
|
|
@ -264,8 +264,14 @@ namespace Ignitor
|
||||||
|
|
||||||
case RenderTreeFrameType.ElementReferenceCapture:
|
case RenderTreeFrameType.ElementReferenceCapture:
|
||||||
{
|
{
|
||||||
// No action for reference captures.
|
if (parent is ElementNode)
|
||||||
break;
|
{
|
||||||
|
return 0; // A "capture" is a child in the diff, but has no node in the DOM
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Reference capture frames can only be children of element frames.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case RenderTreeFrameType.Markup:
|
case RenderTreeFrameType.Markup:
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ namespace Ignitor
|
||||||
return DispatchEventCore(connection, Serialize(webEventDescriptor), Serialize(args));
|
return DispatchEventCore(connection, Serialize(webEventDescriptor), Serialize(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Task ClickAsync(HubConnection connection)
|
public Task ClickAsync(HubConnection connection)
|
||||||
{
|
{
|
||||||
if (!Events.TryGetValue("click", out var clickEventDescriptor))
|
if (!Events.TryGetValue("click", out var clickEventDescriptor))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue