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

refactor: update LoadingIndicator component #2433

Closed

Conversation

Ghaby-X
Copy link

@Ghaby-X Ghaby-X commented Sep 22, 2024

Which problem is this PR solving?

This PR aims to ensure compatibility of the LoadingIndicator component with future React releases. The LoadingIndicator component was using the older defaultProps syntax, which will be removed in future React versions.

Description of the changes

The following changes have been made to the LoadingIndicator component:

  • Removed the defaultProps object from the LoadingIndicator component.
  • Updated LoadingIndicator component to use default parameter values instead.
  • Updated instances where components were called, to match rendered snapshots

How was this change tested?

  • Default tests provided for the LoadingIndicator component was used to ensure it renders exactly as before the changes were made

Checklist

@Ghaby-X Ghaby-X requested a review from a team as a code owner September 22, 2024 21:27
@Ghaby-X Ghaby-X requested review from joe-elliott and removed request for a team September 22, 2024 21:27
Signed-off-by: Gabriel Anyaele <gabrielanyaele21@gmail.com>
@Ghaby-X Ghaby-X force-pushed the refactor/update-LoadingIndicator branch from 0f28d11 to 615253b Compare September 22, 2024 21:32
@@ -159,7 +159,7 @@ export class UnconnectedDetailsPanel extends React.PureComponent<TProps, TState>
)}
{this.state.detailsLoading && (
<div className="Ddg--DetailsPanel--LoadingWrapper">
<LoadingIndicator className="Ddg--DetailsPanel--LoadingIndicator" />
<LoadingIndicator centered={false} className="Ddg--DetailsPanel--LoadingIndicator" small={false} />
Copy link
Member

Choose a reason for hiding this comment

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

false values are defaults, why do we need to set them explicitly?

Copy link
Author

Choose a reason for hiding this comment

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

False values are indeed default. However, it seems there was a mismatch between the tests snapshot and the actual rendered component.
The snapshots explicitly included the false values even though it could be ignored, so I wrote the components to match them.

Copy link
Member

Choose a reason for hiding this comment

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

I would rather update the snapshots

@Ghaby-X Ghaby-X closed this Sep 28, 2024
@Ghaby-X Ghaby-X deleted the refactor/update-LoadingIndicator branch September 28, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants