Skip to content

Conversation

@malwilley
Copy link
Member

The connect monitors drawer on the edit automation page was not filtering by project correctly

@malwilley malwilley requested a review from a team as a code owner November 18, 2025 23:24
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 18, 2025
setSearchQuery(query);
setCursor(undefined);
}, []);
const {selection} = usePageFilters();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Toggling monitors in the filtered 'All Monitors' section leads to incorrect cache updates due to a query key mismatch in toggleConnected.
Severity: HIGH | Confidence: 1.00

🔍 Detailed Analysis

When a user toggles a monitor in the 'AllMonitors' section, the toggleConnected function attempts to update the cache. However, the makeDetectorListQueryKey call within toggleConnected does not include the projects parameter, while the 'AllMonitors' list itself creates its query key with the projects parameter. This mismatch results in different query keys, preventing the cache update from correctly reflecting the change in the displayed list. Consequently, the UI might not accurately show the connection or disconnection status of the monitor.

💡 Suggested Fix

Modify the toggleConnected function to pass the projects parameter to makeDetectorListQueryKey when updating the cache, ensuring consistency with the query key used for fetching the filtered list.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: static/app/views/automations/components/editConnectedMonitors.tsx#L68

Potential issue: When a user toggles a monitor in the 'AllMonitors' section, the
`toggleConnected` function attempts to update the cache. However, the
`makeDetectorListQueryKey` call within `toggleConnected` does not include the `projects`
parameter, while the 'AllMonitors' list itself creates its query key with the `projects`
parameter. This mismatch results in different query keys, preventing the cache update
from correctly reflecting the change in the displayed list. Consequently, the UI might
not accurately show the connection or disconnection status of the monitor.

Did we get this right? 👍 / 👎 to inform future reviews.

Reference_id: 2787239

@malwilley malwilley merged commit f58c568 into master Nov 19, 2025
48 checks passed
@malwilley malwilley deleted the malwilley/fix/filter-connected-monitors-drawer-by-project branch November 19, 2025 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants