Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Sentry side effect in pure function fires every render
- Removed the
Sentry.captureMessagecall fromclampWidgetLayoutso render-path layout clamping is now pure and no longer emits repeated events on re-renders.
- Removed the
Or push these changes by commenting:
@cursor push f0f519073e
Preview (f0f519073e)
diff --git a/static/app/views/dashboards/clampWidgetLayout.tsx b/static/app/views/dashboards/clampWidgetLayout.tsx
--- a/static/app/views/dashboards/clampWidgetLayout.tsx
+++ b/static/app/views/dashboards/clampWidgetLayout.tsx
@@ -1,5 +1,3 @@
-import * as Sentry from '@sentry/react';
-
import {NUM_DESKTOP_COLS} from 'sentry/views/dashboards/constants';
import type {WidgetLayout} from './types';
@@ -14,14 +12,5 @@
const x = Math.max(0, Math.min(layout.x, NUM_DESKTOP_COLS - 1));
const clampedW = Math.min(w, NUM_DESKTOP_COLS - x);
- if (layout.w !== clampedW || layout.x !== x) {
- Sentry.captureMessage('Invalid widget layout dimensions detected', {
- extra: {
- original: {x: layout.x, y: layout.y, w: layout.w, h: layout.h},
- clamped: {x, w: clampedW},
- },
- });
- }
-
return {...layout, w: clampedW, x};
}cbd75d9 to
af579ea
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…owser crash Widgets created via external tools (e.g. LLMs) can have dimensions exceeding the 6-column grid maximum (e.g. w:12). This causes an infinite re-render loop in react-grid-layout when entering edit mode, leading to 100% CPU usage and browser crash. Add clampWidgetLayout() that normalizes oversized layouts before they reach react-grid-layout, applied in getDashboardLayout() and assignDefaultLayout(). Invalid layouts are logged to Sentry via captureMessage for observability. Refs DAIN-1265 Co-Authored-By: Claude <noreply@anthropic.com>
af579ea to
e628a57
Compare
gggritso
added a commit
that referenced
this pull request
Mar 4, 2026
…109826) Replace the custom `LayoutField` with a `LayoutSerializer` using DRF's built-in `IntegerField` validators to reject invalid widget dimensions at the API level. Widgets created via external tools (e.g. LLMs) can have invalid dimensions like `w: 12` where the grid maximum is `6`. This change prevents such layouts from being persisted. The `LayoutSerializer` also lets drf-spectacular auto-generate accurate OpenAPI documentation with field types and constraints, removing the need for manual `@extend_schema_field` annotations. Frontend clamping counterpart: #109825 Refs DAIN-1266 Co-authored-by: Claude <noreply@anthropic.com>
nikkikapadia
approved these changes
Mar 4, 2026
Member
nikkikapadia
left a comment
There was a problem hiding this comment.
lgtm just have a clarifying question
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add frontend clamping for widget layout dimensions that exceed the 6-column grid bounds.
Widgets created via external tools (e.g. LLMs) can have dimensions like
w: 12where the maximum is6. This causes an infinite re-render loop in react-grid-layout when entering edit mode, crashing the browser. The newclampWidgetLayout()function normalizes dimensions before they reach the grid library, and logs invalid layouts to Sentry for observability.Backend validation counterpart: #109826
Refs DAIN-1265