Skip to content

Commit

Permalink
Fix: don't show initial label when backend state is not valid #24
Browse files Browse the repository at this point in the history
  • Loading branch information
luckylooky2 committed Apr 14, 2024
1 parent 4988bc1 commit 4e2fd71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const DashboardSelect = () => {
className={cx(gitHubButtonStyles.button, gitHubButtonStyles.basicButton, styles.button)}
aria-label="New"
>
<div className={styles.ellipsis}>{currDashboard}</div>
<div className={styles.ellipsis}>{backendState.isValid ? currDashboard : ''}</div>
</ToolbarButton>
</div>
</Dropdown>
Expand Down
5 changes: 3 additions & 2 deletions public/app/features/dashboard/containers/OptionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ interface Props {
}

const OptionSelect = ({ picker }: Props) => {
const dashboards = useSelector((state) => state.fourtyTwoClusterBackend).dashboards;
const backendState = useSelector((state) => state.fourtyTwoClusterBackend);
const dashboards = backendState.dashboards;
const [isOpen, setIsOpen] = useState(false);
const gitHubButtonStyles = useStyles2(GitHubButtonStyles);
const styles = useStyles2(getStyles);
Expand Down Expand Up @@ -77,7 +78,7 @@ const OptionSelect = ({ picker }: Props) => {
className={cx(gitHubButtonStyles.button, gitHubButtonStyles.greenButton)}
aria-label="New"
>
<div className={styles.ellipsis}>{currSubCategory}</div>
<div className={styles.ellipsis}>{backendState.isValid ? currSubCategory : ''}</div>
</ToolbarButton>
</Dropdown>
);
Expand Down

0 comments on commit 4e2fd71

Please sign in to comment.