Skip to content
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

fix: TypeScript performance of BarPercent.tsx #11076

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tech Stories
---

Fix TypeScript Performance of `BarPercent.tsx` ([#11076](https://github.com/linode/manager/pull/11076))
5 changes: 3 additions & 2 deletions packages/manager/src/components/BarPercent/BarPercent.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { styled } from '@mui/material/styles';
import { SxProps } from '@mui/system';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another win for pnpm (#11000). By nature it won't allow imports from a package that are not an explicit dependency.

Here, we are importing from @mui/system which is not defined in our package.json

Copy link
Member Author

@bnussman-akamai bnussman-akamai Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use eslint to prevent imports but having a more solid foundation (a better package manager) would be a better fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By nature it won't allow imports from a package that are not an explicit dependency.

music to my ears

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these changes be applied to other instances where we are importing @mui/system as well?

Screenshot 2024-10-09 at 12 17 02β€―PM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I believe so. I'll do a follow up PR for this!

import * as React from 'react';

import { LinearProgress } from 'src/components/LinearProgress';
import { omittedProps } from 'src/utilities/omittedProps';

import type { SxProps, Theme } from '@mui/material/styles';

export interface BarPercentProps {
/** Additional css class to pass to the component */
className?: string;
Expand All @@ -16,7 +17,7 @@ export interface BarPercentProps {
narrow?: boolean;
/** Applies a `border-radius` to the bar. */
rounded?: boolean;
sx?: SxProps;
sx?: SxProps<Theme>;
/** The value of the progress indicator for the determinate and buffer variants. */
value: number;
/** The value for the buffer variant. */
Expand Down