Skip to content

Add better loaders#270

Closed
akalia-atlassian wants to merge 15 commits intomainfrom
add-better-loaders
Closed

Add better loaders#270
akalia-atlassian wants to merge 15 commits intomainfrom
add-better-loaders

Conversation

@akalia-atlassian
Copy link
Contributor

What Is This Change?

This PR does two things:

  1. Does a minor refactor of PR details page state - instead of calculating and passing everything from the top, now the state is calculated from the child components where it is used: this massively simplifies the top level page.
  2. Adds loaders to the PR:
    a. Check if the basic data is there. If not, it waits and shows a page wide loading. This avoids awkward Ui state like empty PR id and titles.
    b. Once the basic page is loaded, it shows the loaders as subtle skeleton shimmers instead of circular loaders.

How Has This Been Tested?

Old Circular Loaders: https://www.loom.com/share/d78a7ca19ab9430f8a3fa2e5a1ab6999

New Subtle Loaders: https://www.loom.com/share/6017f8612fd14b3889de821f0e7b0bd2

Basic checks:

  • npm run lint
  • npm run test

Advanced checks:

  • If Atlassian employee & Bitbucket changes: did you test with DC in mind? See Instructions

Recommendations:

  • Update the CHANGELOG if making a user facing change

@akalia-atlassian akalia-atlassian changed the base branch from main to sn/theme-and-side-panel-revamp April 1, 2025 19:36
Copy link
Contributor Author

@akalia-atlassian akalia-atlassian Apr 1, 2025

Choose a reason for hiding this comment

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

This file is showing changes because we reverted from 2 to 4 line change in a previous PR and took a merge from it in this one. Ideally, this one should disappear if all the stacked PRs underneath will get merged.

I took a merge because this PR adds tweo dependencies as evidenced if look at it via the rich diff feature of GitHub.

'.vscode-dark': {
'--ds-icon-success': '#2ABB7F',
'--ds-icon-warning': '#F5CD47',
'--ds-skeleton': '#CECED912',
Copy link
Contributor Author

@akalia-atlassian akalia-atlassian Apr 1, 2025

Choose a reason for hiding this comment

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

The new components demand this. And because they are translucent shimmers with no VS Code equivalent. So just used Atlassian design values.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally link these to sources you fetched this from so they can be kept in sync.
Alternatively, why don't we fetch this from the package that stores all named colors?

</ExpansionPanelSummary>
<ExpansionPanelDetails>{isLoading ? <CircularProgress /> : children}</ExpansionPanelDetails>
<ExpansionPanelDetails>
{isLoading ? <Skeleton width="100%" height="80px" borderRadius={3} /> : children}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes the loader used.


const PullRequestSidebar: React.FC<PullRequestSidebarProps> = ({ state, controller, taskTitle }) => {
const PullRequestSidebar: React.FC<PullRequestSidebarProps> = ({ state, controller }) => {
const taskSubtitle = useMemo(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactor: calculating here instead of passing from above.

return numTasks === 0 ? '0 tasks' : `${numCompletedTasks} of ${numTasks} complete`;
}, [state.tasks]);

const buildStatusSubtitle = useMemo(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is slightly different: Instead of just saying "x of x builds passed", now it says "Builds | x of x passed". This is to mimic how task panel handles it - the 0 builds case should have no such qualification.

isLoading={state.loadState.buildStatuses}
isDefaultExpanded
hidden={state.buildStatuses.length === 0}
hidden={false}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed hidden: users will want to know if there is nothing too. Removing the panel is more confusing.

<Grid item>
<BasicPanel
isLoading={state.loadState.basicData}
isLoading={state.loadState.buildStatuses}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

More accurate isLoading value: there is no loading for reviewers so using build statuses.

</Paper>
</Grid>
</Grid>
{state.loadState.basicData ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If basicData is not there, it shows a simple, full page loading message.


prHeaderTitle: {
flex: '1 0 auto',
flex: '1 1 auto',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change from a previous PR - important but this PR is not the source of truth for this.


return (
<Grid container direction="column" style={{ padding: '0', width: '100%' }}>
{activeParticipants.length === 0 ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This diff is so big because we removed the "No reviewers!" message (which changed the indent) if there are no reviewers: now it simply shows nothing - we already have an "Add reviewer" button underneath to direct the users towards action.

Copy link
Collaborator

@bwieger-atlassian-com bwieger-atlassian-com left a comment

Choose a reason for hiding this comment

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

LGTM ✅

Checked out, built, manually test

@sn2912 sn2912 force-pushed the sn/theme-and-side-panel-revamp branch from 117bb23 to f94253f Compare April 2, 2025 18:25
Base automatically changed from sn/theme-and-side-panel-revamp to main April 3, 2025 08:02
@akalia-atlassian akalia-atlassian dismissed bwieger-atlassian-com’s stale review April 3, 2025 08:02

The base branch was changed.

@akalia-atlassian
Copy link
Contributor Author

This PR has been superseded by another existing open PR. This is to reduce the clutter.

@marcomura marcomura deleted the add-better-loaders branch September 26, 2025 05:48
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.

4 participants