-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revert: table empty state icon changes #3850
Conversation
In the commit ad2c042 we are not setting the empty value by default causing the downstream application to fail
✅ Deploy Preview for carbon-addons-iot-react ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -86,7 +86,7 @@ const EmptyTable = ({ | |||
/> | |||
) : ( | |||
<EmptyState | |||
icon={emptyStateIcon ?? 'empty'} | |||
icon={emptyStateIcon !== '' ? emptyStateIcon : 'empty'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is reverting, but what was the original code before you did any of this enumeration stuff.
The default value for emptyStateIcon is '', so in the previous change if emptyStateIcon is undefined, then it would bet set to '' and therefor no icon. In the new change if emptyStateIcon is undefined it will be set to '' and based on the condition it will use 'empty'. Is that the correct behaviour?
was the original behaviour such that if the prop was no specified then it would use the 'empy' icon? if so, then I think we are good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty fallback would work only if emptyStateIcon
is undefined or null in the defaultProps
since this is an empty string, that is a "valid value" for the Nullish coalescing operator... that's why "empty" is not being used.
So if we want it to work with ??
the default props need to be undefined/null
otherwise makes sense to revert to this code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cgirani The challenge (and what I'm trying to get to, is the default behaviour before the changes were in place).
This "revert" comes as a request from a downstream consumer where this change caused changes in the default behaviour of the component. (I suspect that previously they were not setting the emptyStateIcon and was seeing empty, and after the bullish coalescing operator was used they got no icon (because the default value is an empty string it can never be undefined).
as a rule of thumb when we update components adding new features, etc, we never want to change the default behaviour of the component and I think this change did that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stuckless yup. you are correct. Default behavior was having an empty icon. I could have updated the monitor code but the issue is we can't update our old codebase easily (8.11.x and 8.10.x). So just to keep the exact same behaviour I have set this to default.
@cgirani One more thing to note is changing the prop name also can break the downstream system. example in the Previous commit noDataIcon
changed to emptyStateIcon
.
we should avoid this kind of change in patch releases so that we dont break downstream systems.
Since the monitor does not use noDataIcon
and depends on default behavior we are not facing any issues.
Summary
Change List (commits, features, bugs, etc)
Acceptance Test (how to verify the PR)
Regression Test (how to make sure this PR doesn't break old functionality)
Things to look for during review
iot
orbx
class prefix is using the prefix variabledata-testid
attribute. New test ids should have test written to ensure they are not changed or removed.