kgabryje commented on code in PR #30611:
URL: https://github.com/apache/superset/pull/30611#discussion_r1806754886
##########
superset-frontend/src/dashboard/components/Header/index.jsx:
##########
@@ -519,44 +522,47 @@ class Header extends PureComponent {
<div
css={headerContainerStyle}
data-test="dashboard-header-container"
- data-test-id={dashboardInfo.id}
+ data-test-id={dashboardInfo?.id}
className="dashboard-header-container"
>
<PageHeaderWithActions
editableTitleProps={{
title: dashboardTitle,
- canEdit: userCanEdit && editMode,
+ canEdit: !!(userCanEdit && editMode),
onSave: this.handleChangeText,
placeholder: t('Add the name of the dashboard'),
label: t('Dashboard title'),
showTooltip: false,
+ loading: !dashboardTitle,
}}
certificatiedBadgeProps={{
- certifiedBy: dashboardInfo.certified_by,
- details: dashboardInfo.certification_details,
+ certifiedBy: dashboardInfo?.certified_by,
+ details: dashboardInfo?.certification_details,
}}
faveStarProps={{
- itemId: dashboardInfo.id,
+ itemId: dashboardInfo?.id,
fetchFaveStar: this.props.fetchFaveStar,
saveFaveStar: this.props.saveFaveStar,
isStarred: this.props.isStarred,
- showTooltip: true,
+ showTooltip: !!dashboardInfo?.id,
Review Comment:
It's very unlikely (or impossible?) but if dashboard's id is 0, then the
boolean logic based on it will fail. Can we use `isDefined(dashboardInfo?.id)`
instead? Here and other places where dashboard id is cast to boolean
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]