chore: updated loading
ad337ade
1 file(s) · +7 −10
| 29 | 29 | ||
| 30 | 30 | function App() { |
|
| 31 | 31 | const allFeeds = useQuery(allFeedsQuery); |
|
| 32 | - | const hasFeeds = allFeeds.rows?.length > 0; |
|
| 32 | + | const hasFeeds = allFeeds.length > 0; |
|
| 33 | 33 | const [isInitialLoading, setIsInitialLoading] = React.useState(true); |
|
| 34 | 34 | const [urlInput, setUrlInput] = React.useState(""); |
|
| 35 | 35 | const [isAddingFeed, setIsAddingFeed] = React.useState(false); |
|
| 43 | 43 | ||
| 44 | 44 | // Handle initial loading state |
|
| 45 | 45 | React.useEffect(() => { |
|
| 46 | - | // Wait for the query to be loaded (not pending) |
|
| 47 | - | if (!allFeeds.isLoading) { |
|
| 48 | - | // Add a small delay to prevent flash |
|
| 49 | - | const timer = setTimeout(() => { |
|
| 50 | - | setIsInitialLoading(false); |
|
| 51 | - | }, 300); |
|
| 52 | - | return () => clearTimeout(timer); |
|
| 53 | - | } |
|
| 54 | - | }, [allFeeds.isLoading]); |
|
| 46 | + | // Add a small delay to prevent flash, then stop loading |
|
| 47 | + | const timer = setTimeout(() => { |
|
| 48 | + | setIsInitialLoading(false); |
|
| 49 | + | }, 500); |
|
| 50 | + | return () => clearTimeout(timer); |
|
| 51 | + | }, []); |
|
| 55 | 52 | ||
| 56 | 53 | function handleRestoreDialogOpenChange(open: boolean) { |
|
| 57 | 54 | setIsRestoreDialogOpen(open); |
|