You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug fix (non-breaking change which fixes an issue)
Description
Unify how the image widget looks in previews regarding min/max height. It uses the same code path as runtime for Design Preview. And Simplified following on Structure preview.
What should be covered while testing?
Image widget reacts to setting max and min height in Design and Structure preview.
⚠️ Low — height! in else-branch has no null guard for preview props
File:packages/pluggableWidgets/image-web/src/utils/helpers.ts line 25 Problem:ImagePreviewProps.height is number | null, but the else-branch calls getHeightScale(height!, heightUnit) with no null check. If Studio Pro sends heightUnit = "pixels" and height = null (a theoretically valid state per the typings), getHeightScale receives null and produces "nullpx" — an invalid CSS value applied to the preview element. The minHeight/maxHeight guards are fine because null > 0 already returns false. Fix:
⚠️ Low — No unit tests for constructStyleObject with ImagePreviewProps inputs
File:packages/pluggableWidgets/image-web/src/utils/helpers.ts Note:src/utils/__tests__/ does not exist. Now that constructStyleObject handles a union type with nullable fields (the null! assertions being the risk surface), it's worth adding a small spec covering the ImagePreviewProps path — specifically the heightUnit: "auto" + null minHeight/maxHeight combinations, and the heightUnit: "pixels" + height: null edge case above. Not blocking, but would have caught the null-height issue pre-merge.
Positives
Correct removal of the deprecated props.className in favour of props.class — the typings mark className as deprecated since 9.18.0 and this was a real divergence from the runtime path.
The minHeight/maxHeight null guards (> 0) already function as runtime null checks since null > 0 === false, so the ! assertions there are safe.
The boolean short-circuit type === "image" && constructStyleObject(props) spreads safely as a no-op when false — no extra branch needed.
CHANGELOG entry is user-facing behaviour only, no implementation details leaked.
The approximation comment in editorConfig.ts is justified — using maxHeight/minHeight as the structure preview frame height is non-obvious behaviour that a reader would otherwise have to trace back to constructStyleObject to understand.
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
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.
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
Unify how the image widget looks in previews regarding min/max height. It uses the same code path as runtime for Design Preview. And Simplified following on Structure preview.
What should be covered while testing?
Image widget reacts to setting max and min height in Design and Structure preview.