Skip to content

Commit 90917be

Browse files
SuthiYuvarajCopilot
authored andcommitted
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2e08b43 commit 90917be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Core/src/LifecycleEvents/LifecycleEventService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ internal void RemoveEvent<TDelegate>(string eventName, TDelegate action)
4545
{
4646
if (_mapper.TryGetValue(eventName, out var delegates) && delegates != null)
4747
{
48-
delegates.Remove(action);
48+
if (delegates.Remove(action) && delegates.Count == 0)
49+
_mapper.Remove(eventName);
4950
}
5051
}
5152
}

0 commit comments

Comments
 (0)