Conversation
Replace the custom LayoutField with a LayoutSerializer that uses DRF's built-in IntegerField validators (min_value/max_value) to reject invalid widget dimensions at the API level. This prevents widgets with out-of-bounds layouts from being persisted via the API. 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. Refs DAIN-1266 Co-Authored-By: Claude <noreply@anthropic.com>
1553218 to
5baf0cf
Compare
gggritso
added a commit
that referenced
this pull request
Mar 4, 2026
#109825) 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: 12` where the maximum is `6`. This causes an infinite re-render loop in react-grid-layout when entering edit mode, crashing the browser. The new `clampWidgetLayout()` function normalizes dimensions before they reach the grid library, and logs invalid layouts to Sentry for observability. Backend validation counterpart: #109826 Refs DAIN-1265 Co-authored-by: Claude <noreply@anthropic.com>
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.
Replace the custom
LayoutFieldwith aLayoutSerializerusing DRF's built-inIntegerFieldvalidators to reject invalid widget dimensions at the API level.Widgets created via external tools (e.g. LLMs) can have invalid dimensions like
w: 12where the grid maximum is6. This change prevents such layouts from being persisted. TheLayoutSerializeralso lets drf-spectacular auto-generate accurate OpenAPI documentation with field types and constraints, removing the need for manual@extend_schema_fieldannotations.Frontend clamping counterpart: #109825
Refs DAIN-1266