Skip to content

Added skeleton loader on slow machinery requests#4086

Open
wassafshahzad wants to merge 5 commits intomozilla:mainfrom
wassafshahzad:wassaf/4074-machinery-loading-state
Open

Added skeleton loader on slow machinery requests#4086
wassafshahzad wants to merge 5 commits intomozilla:mainfrom
wassafshahzad:wassaf/4074-machinery-loading-state

Conversation

@wassafshahzad
Copy link
Copy Markdown
Contributor

@wassafshahzad wassafshahzad commented Apr 15, 2026

Description

Added a skeleton loader and fetch state to render skeleton loader on slow machinery requests.

Linked Issue

Closes #4074

Screenshot

skeleton structure

Skeleton Machinery Loader

SkeletonStructure2

Skeleton Machinery Loader Updated UI

MachinerySkeletonLoader3

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 27.27273% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.04%. Comparing base (8d99a28) to head (9cc014b).
⚠️ Report is 5 commits behind head on main.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wassafshahzad
Copy link
Copy Markdown
Contributor Author

The missing lines in test, are in MachineryTranslations.tsx around the async fetch logic. That code was already there before my changes, I just wired fetching state into it.

Testing it properly would need mocking 5 API calls, Redux, and multiple React contexts which felt out of scope for a loading indicator fix. Added two tests in Machinery.test.jsx covering the actual UI change instead.

Happy to add provider tests in a follow-up if needed.

Copy link
Copy Markdown
Collaborator

@mathjazz mathjazz left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

Please see my comment below for the SkeletonLoader layout.

))}
</ul>
{machineryFetching && translations.length === 0 && (
<SkeletonLoader items={[]} />
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a good opportunity to introduce a new skeleton loader, that matches the layout of Machinery results. The one we use in this file is actually imitating the string list results.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this UI fine ?
SkeletonStructure2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update! Could you please separate the lines for source and target text, and make the full-width and same height as they were in the SkeletonLoader?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure will do

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mathjazz Updated loader UI

@wassafshahzad wassafshahzad requested a review from mathjazz April 16, 2026 10:24
Copy link
Copy Markdown
Collaborator

@mathjazz mathjazz left a comment

Choose a reason for hiding this comment

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

Nice work - it works really well!

Please see my comment inline for improved code maintainability.

@@ -0,0 +1,33 @@
import React from 'react';

import '~/modules/loaders/components/SkeletonLoader.css';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This file should be moved to translate/src/modules/loaders/components and have it's own MachinerySkeletonLoader.tsx file.

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.

Loading state of Google Translate request should be clearer

3 participants