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
The image widget never checked that value is not available while the image is loading, this made it start fetching images with the url /undefined. this change fixes it by not rendering the widget id the image (and fallback) is not available or still loading.
r0b1n
changed the title
[WC3477] Do not render image when the image is not available
[WC-3477] Do not render image when the image is not available
Jul 2, 2026
File:packages/pluggableWidgets/image-web/src/Image.tsx line 17 Note: The check return image ? ... : null gates rendering on whether the image string is truthy. For the "icon" datasource an icon class can legitimately be an empty string (e.g. a misconfigured glyph/icon), which would silently suppress the widget with no feedback. The fix correctly prevents undefined from reaching the <img src>, but an explicit !== undefined comparison communicates intent more precisely and avoids the empty-string edge case.
⚠️ Low — imageUrl loading branch passes stale value without null-guard
File:packages/pluggableWidgets/image-web/src/utils/getImageProps.ts lines 41–43 Note: When imageUrl.status === ValueStatus.Loading, imageUrl.value is typed as T | undefined. The code already returns undefined correctly when there is no cached value (the test at spec line 92–98 confirms this). However the conditional uses imageUrl.value (without optional chaining) after the truthy branch has already asserted the status — this is fine because value can be undefined and just results in the stale-URL behaviour. No code change is strictly needed, but adding the test label // stale value would clarify intent for readers.
Positives
Uses dynamic.available / dynamic.loading / dynamic.unavailable builders from @mendix/widget-plugin-test-utils instead of hand-crafted mock objects — exactly the right pattern.
Extracted getImageProps into a pure function (GetImagePropsInput input type, no React dependency) makes it trivially unit-testable without mounting a component.
The Loading status is now handled alongside Available for both the main image and fallback — this is the core fix and it's correct: a cached .value?.uri is returned when present, undefined when not.
All three datasource branches ("image", "imageUrl", "icon") are covered with every status variant; the unknown datasource default branch is tested too.
CHANGELOG entry is user-facing language (describes visible behaviour, not implementation detail) — consistent with repo conventions.
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
The image widget never checked that value is not available while the image is loading, this made it start fetching images with the url
/undefined. this change fixes it by not rendering the widget id the image (and fallback) is not available or still loading.