Skip to content

Commit

Permalink
fix(frontend): improve error message for missing '#storybook-root' el…
Browse files Browse the repository at this point in the history
…ement & update ts

- Updated TypeScript version from `^4.4.x` to `^5.7.3` in `package.json` and `package-lock.json`.
- Removed unused import of `React` in `Common.tsx` and `SectionHeader.tsx`.
- Fixed type coercion issue in `InstanceCountLabel` component by converting `countText` to a number.
- Ensured `aria-label` in `SectionHeader` uses `toString()` for translation.
- facebook/create-react-app#13080
- certain deps demand higher ts version while react-scripts still depend
  on older ts versions
- react-scripts still works fine with newer ts therefore overwrite ts
  version
  • Loading branch information
ErvinRacz committed Mar 7, 2025
1 parent 6bcc786 commit 8d6cbda
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 35 deletions.
2 changes: 1 addition & 1 deletion frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const config: StorybookConfig = {
docs: {},

typescript: {
reactDocgen: 'react-docgen-typescript'
reactDocgen: 'react-docgen-typescript',
}
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/.storybook/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const config: TestRunnerConfig = {
const innerHTML = await elementHandler.innerHTML();
expect(innerHTML).toMatchSnapshot();
} else {
throw new Error("elementHandler is null!");
throw new Error("The '#storybook-root' element was not found. elementHandler is null!");
}
},
};
Expand Down
42 changes: 14 additions & 28 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"yup": "^0.32.9"
},
"overrides": {
"react-refresh": "^0.14.2"
"react-refresh": "^0.14.2",
"typescript": "5.7.2"
},
"devDependencies": {
"@axe-core/react": "^4.2.2",
Expand Down Expand Up @@ -94,7 +95,7 @@
"pg": "^8.13.1",
"prettier": "^2.3.2",
"storybook": "^8.5.8",
"typescript": "^4.4.x"
"typescript": "5.7.2"
},
"scripts": {
"build-icons": "node tools/build-icons.js ./src/img ./src/icons && npm run format",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Instances/Common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function InstanceCountLabel(props: {
<Typography className={classes.instancesCount}>{countText}</Typography>
</Grid>
<Grid item>
{!instanceListView && countText > 0 ? (
{!instanceListView && Number(countText) > 0 ? (
<Box>
{!props.loading && (
<Link to={{ ...href }} component={RouterLink} underline="hover">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Grid from '@mui/material/Grid';
import Link from '@mui/material/Link';
import Typography from '@mui/material/Typography';
import makeStyles from '@mui/styles/makeStyles';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Link as RouterLink } from 'react-router-dom';
import PageTitle from '../PageTitle/PageTitle';
Expand Down Expand Up @@ -49,7 +48,7 @@ export default function SectionHeader(props: SectionHeaderProps) {
>
<Grid item>
<Breadcrumbs
aria-label={t('common|breadcrumbs')}
aria-label={t('common|breadcrumbs').toString()}
separator={<NavigateNextIcon fontSize="small" />}
>
{breadcrumbs &&
Expand Down

0 comments on commit 8d6cbda

Please # to comment.