Skip to content

Commit 3bc834c

Browse files
committed
hot reload fix
1 parent 0206636 commit 3bc834c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

RazorStyle.Example/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
app.UseHsts();
1919
}
2020

21-
app.UseHttpsRedirection();
22-
2321
app.UseStaticFiles();
2422

2523
app.UseRouting();

RazorStyle/Style.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ protected override void OnInitialized()
2323
StyleRoot.AddIfMissing(ChildContent, BuildTriggerAnimations);
2424
}
2525

26+
protected override void OnAfterRender(bool firstRender)
27+
{
28+
if (ChildContent is null)
29+
return;
30+
31+
if (StyleRoot.EnableHotReload)
32+
StyleRoot.AddIfMissing(ChildContent, BuildTriggerAnimations);
33+
}
34+
2635
string BuildTriggerAnimations()
2736
{
2837
var builder = new RenderTreeBuilder();

0 commit comments

Comments
 (0)