Skip to content

Commit

Permalink
fix for loading animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymmmy committed May 15, 2024
1 parent 0770083 commit d938c63
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
10 changes: 0 additions & 10 deletions app/components/loader.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import { motion } from "framer-motion";
import { useEffect } from "react";
import { useBackdropContext } from "~/lib/context/backdrop";

export function Fallback() {
const { isLoading, setIsLoading } = useBackdropContext();

useEffect(() => {
setIsLoading(true);
return () => {
setIsLoading(false);
};
}, [isLoading, setIsLoading]);

return null;
}

Expand Down
2 changes: 1 addition & 1 deletion app/components/providers/backdropProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type BackdropProviderProps = {
};

export const BackdropProvider = ({ children }: BackdropProviderProps) => {
const [isLoading, setIsLoading] = useState(false);
const [isLoading, setIsLoading] = useState(true);

return (
<BackdropContext.Provider
Expand Down
3 changes: 3 additions & 0 deletions app/routes/finish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Header } from "~/components/header";
import { FinishCheck, FinishError } from "~/components/icons";
import { Fallback, Loader } from "~/components/loader";
import { Button } from "~/components/ui/button";
import { useBackdropContext } from "~/lib/context/backdrop";
import { useDialogContext } from "~/lib/context/dialog";
import {
type PaymentResultType,
Expand Down Expand Up @@ -88,6 +89,7 @@ export default function Finish() {

const { setOpen } = useDialogContext();
setOpen(false);
const { setIsLoading } = useBackdropContext();

return (
<>
Expand All @@ -101,6 +103,7 @@ export default function Finish() {
>
{(outgoingPaymentCheck) => (
<>
{setIsLoading(false)}
{outgoingPaymentCheck.error ? (
<>
<FinishError />
Expand Down

0 comments on commit d938c63

Please sign in to comment.