Skip to content

Commit

Permalink
fix: set a timeout so the loader is run a minimum-runthrough everytime
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 committed Apr 9, 2024
1 parent 162c5ce commit 67b23e1
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/components/landing-page/productions-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ import { TProduction } from "../production-line/types.ts";
import { useGlobalState } from "../../global-state/context-provider.tsx";
import { LoaderDots } from "../loader/loader.tsx";

const Wrapper = styled.div`
display: flex;
padding: 2rem 0 2rem 2rem;
flex-wrap: wrap;
flex-direction: column;
`;

const ProductionListContainer = styled.div`
display: flex;
padding: 2rem 0 2rem 2rem;
Expand Down Expand Up @@ -78,11 +71,15 @@ export const ProductionsList = () => {
dispatch({
type: "PRODUCTION_LIST_FETCHED",
});
setLoading(false);
window.setTimeout(() => {
setLoading(false);
}, 2500);
})
.catch(() => {
// TODO handle error/retry
setLoading(false);
window.setTimeout(() => {
setLoading(false);
}, 2500);
});
}
return () => {
Expand All @@ -91,7 +88,7 @@ export const ProductionsList = () => {
}, [dispatch, reloadProductionList]);

return (
<Wrapper>
<>
<LoaderDots className={loading ? "active" : "in-active"} />
<ProductionListContainer>
{productions.map((p) => (
Expand All @@ -101,6 +98,6 @@ export const ProductionsList = () => {
</ProductionItem>
))}
</ProductionListContainer>
</Wrapper>
</>
);
};

0 comments on commit 67b23e1

Please sign in to comment.