fix: (web) fix refresh icon spinning indefinitely

- Remove redundant isRefreshing state
- Icon spin is controlled by isLoading prop from parent
- Parent correctly manages loading state during fetch
This commit is contained in:
syntaxbullet
2026-01-16 15:20:36 +01:00
parent d117bcb697
commit 7d658bbef9

View File

@@ -212,13 +212,6 @@ function QuestTableContent({ quests }: { quests: QuestListItem[] }) {
} }
export function QuestTable({ quests, isLoading, onRefresh }: QuestTableProps) { export function QuestTable({ quests, isLoading, onRefresh }: QuestTableProps) {
const [isRefreshing, setIsRefreshing] = React.useState(false);
const handleRefresh = async () => {
setIsRefreshing(true);
onRefresh?.();
};
return ( return (
<Card className="glass-card overflow-hidden"> <Card className="glass-card overflow-hidden">
<CardHeader className="pb-3"> <CardHeader className="pb-3">
@@ -235,11 +228,11 @@ export function QuestTable({ quests, isLoading, onRefresh }: QuestTableProps) {
</Badge> </Badge>
)} )}
<button <button
onClick={handleRefresh} onClick={onRefresh}
disabled={isRefreshing} disabled={isLoading}
className={cn( className={cn(
"p-2 rounded-md hover:bg-muted/50 transition-colors", "p-2 rounded-md hover:bg-muted/50 transition-colors",
isRefreshing && "cursor-wait" isLoading && "cursor-wait"
)} )}
title="Refresh quests" title="Refresh quests"
> >
@@ -255,7 +248,7 @@ export function QuestTable({ quests, isLoading, onRefresh }: QuestTableProps) {
strokeLinejoin="round" strokeLinejoin="round"
className={cn( className={cn(
"text-muted-foreground transition-transform", "text-muted-foreground transition-transform",
isRefreshing && "animate-spin" isLoading && "animate-spin"
)} )}
> >
<path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /> <path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />