mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-24 18:47:30 +00:00
Prerendering imposes its own (overridable) timeout with descriptive error
This commit is contained in:
@@ -18,6 +18,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
private const string PrerenderExportAttributeName = "asp-prerender-export";
|
||||
private const string PrerenderWebpackConfigAttributeName = "asp-prerender-webpack-config";
|
||||
private const string PrerenderDataAttributeName = "asp-prerender-data";
|
||||
private const string PrerenderTimeoutAttributeName = "asp-prerender-timeout";
|
||||
private static INodeServices _fallbackNodeServices; // Used only if no INodeServices was registered with DI
|
||||
|
||||
private readonly string _applicationBasePath;
|
||||
@@ -50,6 +51,9 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
[HtmlAttributeName(PrerenderDataAttributeName)]
|
||||
public object CustomDataParameter { get; set; }
|
||||
|
||||
[HtmlAttributeName(PrerenderTimeoutAttributeName)]
|
||||
public int TimeoutMillisecondsParameter { get; set; }
|
||||
|
||||
[HtmlAttributeNotBound]
|
||||
[ViewContext]
|
||||
public ViewContext ViewContext { get; set; }
|
||||
@@ -79,7 +83,8 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
},
|
||||
unencodedAbsoluteUrl,
|
||||
unencodedPathAndQuery,
|
||||
CustomDataParameter);
|
||||
CustomDataParameter,
|
||||
TimeoutMillisecondsParameter);
|
||||
output.Content.SetHtmlContent(result.Html);
|
||||
|
||||
// Also attach any specified globals to the 'window' object. This is useful for transferring
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
JavaScriptModuleExport bootModule,
|
||||
string requestAbsoluteUrl,
|
||||
string requestPathAndQuery,
|
||||
object customDataParameter)
|
||||
object customDataParameter,
|
||||
int timeoutMilliseconds)
|
||||
{
|
||||
return nodeServices.InvokeExportAsync<RenderToStringResult>(
|
||||
NodeScript.Value.FileName,
|
||||
@@ -32,7 +33,8 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
bootModule,
|
||||
requestAbsoluteUrl,
|
||||
requestPathAndQuery,
|
||||
customDataParameter);
|
||||
customDataParameter,
|
||||
timeoutMilliseconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user