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

Show the loading state when duplicates are loading. #2145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 9 additions & 4 deletions src/pages/organize/[orgId]/people/duplicates/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GetServerSideProps } from 'next';
import { Box, Typography } from '@mui/material';
import { Box, CircularProgress, Typography } from '@mui/material';

import DuplicateCard from 'features/duplicates/components/DuplicateCard';
import messageIds from 'features/duplicates/l10n/messageIds';
Expand All @@ -21,18 +21,23 @@ export const getServerSideProps: GetServerSideProps = scaffold(async () => {
const DuplicatesPage: PageWithLayout = () => {
const onServer = useServerSide();
const { orgId } = useNumericRouteParams();
const list = useDuplicates(orgId).data ?? [];
const duplicates = useDuplicates(orgId);
const messages = useMessages(messageIds);

if (onServer) {
return null;
}

const filteredList = list.filter((cluster) => !cluster.dismissed);
const filteredList = (duplicates.data ?? []).filter(
(cluster) => !cluster.dismissed
);

return (
<>
{filteredList.length === 0 && (
{duplicates.isLoading && (
<CircularProgress color="inherit" size="1.5rem" />
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this is missing a margin/padding around it. This is what it looks like when I throttle my connection to "3G" in order to slow down loading:

image

The next case (empty state) has a 2 unit margin. The last case (list) has a 1.5 unit padding. I'm thinking all three should probably be the same instead?

Also, maybe the circular loading indicator should be centered? Wrapping it in a box looking something like this should work:

<Box display="flex" justifyContent="center" m={2}>
  <CircularProgress />
</Box>

)}
{!duplicates.isLoading && filteredList.length === 0 && (
<Box m={2}>
<Typography variant="overline">
{messages.page.noDuplicates()}
Expand Down
Loading