Skip to content

Commit 1c0080d

Browse files
committed
refactor: 兼容 Root 多层嵌套
1 parent d7e68cd commit 1c0080d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/BootstrapBlazor/Services/BootstrapBlazorRootRegisterService.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void Subscribe(object identifier, BootstrapBlazorRootOutlet subscriber)
7777
{
7878
if (_subscribersByIdentifier.ContainsKey(identifier))
7979
{
80-
throw new InvalidOperationException($"There is already a subscriber to the content with the given root ID '{identifier}'.");
80+
return;
8181
}
8282

8383
_subscribersByIdentifier.Add(identifier, subscriber);
@@ -89,10 +89,7 @@ public void Subscribe(object identifier, BootstrapBlazorRootOutlet subscriber)
8989
/// <param name="identifier"></param>
9090
public void Unsubscribe(object identifier)
9191
{
92-
if (!_subscribersByIdentifier.Remove(identifier))
93-
{
94-
throw new InvalidOperationException($"The subscriber with the given root ID '{identifier}' is already unsubscribed.");
95-
}
92+
_subscribersByIdentifier.Remove(identifier);
9693
}
9794

9895
/// <summary>

0 commit comments

Comments
 (0)