Skip to content

Commit

Permalink
fix(jmcagent): correct notification handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Apr 19, 2024
1 parent 89e2786 commit 0f6ced3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/Agent/AgentLiveProbes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const AgentLiveProbes: React.FC<AgentLiveProbesProps> = (_) => {
context.target.target(),
context.notificationChannel.messages(NotificationCategory.ProbeTemplateApplied),
]).subscribe(([currentTarget, e]) => {
if (currentTarget?.connectUrl != e.message.targetId && currentTarget?.jvmId != e.message.jvmId) {
if (currentTarget?.jvmId != e.message.jvmId) {
return;
}
setProbes((old) => {
Expand All @@ -227,7 +227,14 @@ export const AgentLiveProbes: React.FC<AgentLiveProbesProps> = (_) => {

React.useEffect(() => {
addSubscription(
context.notificationChannel.messages(NotificationCategory.ProbesRemoved).subscribe((_) => setProbes([])),
combineLatest([
context.target.target(),
context.notificationChannel.messages(NotificationCategory.ProbesRemoved),
]).subscribe(([currentTarget, e]) => {
if (currentTarget?.jvmId == e.message.jvmId) {
setProbes([]);
}
}),
);
}, [addSubscription, context, context.notificationChannel, setProbes]);

Expand Down

0 comments on commit 0f6ced3

Please sign in to comment.