Skip to content

Conversation

@evanpurkhiser
Copy link
Member

When deleting a monitor, navigate to the detector type-specific list
page (e.g., /monitors/crons/, /monitors/uptime/, /monitors/metrics/)
instead of the base monitors page. This provides a predictable
navigation experience that takes users back to the relevant monitor
type they were working with.

Fixes ID-1106: Deleting a monitor should return to previous list page

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner November 18, 2025 22:07
@linear
Copy link

linear bot commented Nov 18, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 18, 2025
onConfirm: async () => {
await deleteDetector(detector.id);
navigate(makeMonitorBasePathname(organization.slug));
navigate(makeMonitorTypePathname(organization.slug, detector.type));
Copy link

Choose a reason for hiding this comment

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

Bug: The makeMonitorTypePathname function is imported and called in actions.tsx but is not defined, leading to build or runtime errors.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The makeMonitorTypePathname function is imported in static/app/views/detectors/components/details/common/actions.tsx but is not defined in static/app/views/detectors/pathnames.tsx or anywhere else in the codebase. This function is actively called at line 104 within the DeleteDetectorAction component. This will lead to a build-time failure due to a TypeScript/module resolution error or a runtime error when the DeleteDetectorAction component attempts to execute, preventing users from deleting detectors. The PR appears to be incomplete, as it introduces the usage of this function without defining it.

💡 Suggested Fix

Define the makeMonitorTypePathname function in static/app/views/detectors/pathnames.tsx to correctly map detector types to their corresponding list pages.

🤖 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/detectors/components/details/common/actions.tsx#L104

Potential issue: The `makeMonitorTypePathname` function is imported in
`static/app/views/detectors/components/details/common/actions.tsx` but is not defined in
`static/app/views/detectors/pathnames.tsx` or anywhere else in the codebase. This
function is actively called at line 104 within the `DeleteDetectorAction` component.
This will lead to a build-time failure due to a TypeScript/module resolution error or a
runtime error when the `DeleteDetectorAction` component attempts to execute, preventing
users from deleting detectors. The PR appears to be incomplete, as it introduces the
usage of this function without defining it.

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

Reference_id: 2785176

Copy link
Member Author

Choose a reason for hiding this comment

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

part of a diff PR

@codecov
Copy link

codecov bot commented Nov 18, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
12589 1 12588 10
View the top 1 failed test(s) by shortest run time
DetectorEdit EditDetectorActions calls delete mutation when deletion is confirmed
Stack Traces | 1.11s run time
Error: expect(received).toBe(expected) // Object.is equality

Expected: ".../org-slug/monitors/metrics/"
Received: ".../monitors/1/edit/"
    at Object.toBe (.../views/detectors/edit.spec.tsx:146:40)
    at runNextTicks (node:internal/process/task_queues:65:5)
    at listOnTimeout (node:internal/timers:549:9)
    at processTimers (node:internal/timers:523:7)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

When deleting a monitor, navigate to the detector type-specific list
page (e.g., /monitors/crons/, /monitors/uptime/, /monitors/metrics/)
instead of the base monitors page. This provides a predictable
navigation experience that takes users back to the relevant monitor
type they were working with.

Fixes [ID-1106: Deleting a monitor should return to previous list page](https://linear.app/getsentry/issue/ID-1106/deleting-a-monitor-should-return-to-previous-list-page)
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) November 18, 2025 23:06
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/fix-detectors-navigate-to-detector-type-list-page-after-deletion branch from b789bfa to 76e0add Compare November 18, 2025 23:06
@evanpurkhiser evanpurkhiser merged commit b710c6b into master Nov 18, 2025
47 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/fix-detectors-navigate-to-detector-type-list-page-after-deletion branch November 18, 2025 23:17
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