Skip to content

Commit

Permalink
ui: more accurately call isSetLoading when clicking mirror (#1297)
Browse files Browse the repository at this point in the history
Before clicking on div, not link, would cause throbber without loading
mirror
  • Loading branch information
serprex authored Feb 15, 2024
1 parent 5cac242 commit 59d7ee2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/app/mirrors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function Mirrors() {
<Header
variant='title2'
slot={
<Button as={Link} href={'/mirrors/create'} variant='normalSolid'>
<Button as={Link} href='/mirrors/create' variant='normalSolid'>
<div
style={{
display: 'flex',
Expand Down
12 changes: 10 additions & 2 deletions ui/components/MirrorLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@
import { Label } from '@/lib/Label';
import { ProgressCircle } from '@/lib/ProgressCircle';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useState } from 'react';

const MirrorLink = ({ flowName }: { flowName: string }) => {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
return (
<div onClick={() => setIsLoading(true)}>
<div>
{isLoading ? (
<ProgressCircle variant='determinate_progress_circle' />
) : (
<Link href={`/mirrors/${flowName}`}>
<Link
href={`/mirrors/${flowName}`}
onClick={() => {
setIsLoading(true);
router.push(`/mirrors/${flowName}`);
}}
>
<Label>
<div className='cursor-pointer underline'>{flowName}</div>
</Label>
Expand Down

0 comments on commit 59d7ee2

Please sign in to comment.