|
1 | 1 | import { useState, useEffect } from "react"; |
2 | 2 | import { useMutation } from "@tanstack/react-query"; |
3 | | -import { useSearchParams } from "react-router-dom"; |
4 | 3 | import { apiRequest } from "@/lib/queryClient"; |
5 | 4 | import { Header } from "@/components/header-new"; |
6 | 5 | import { Footer } from "@/components/footer"; |
@@ -36,7 +35,6 @@ import { SocialSentimentCard } from "@/components/social-sentiment-card"; |
36 | 35 |
|
37 | 36 | export default function Home() { |
38 | 37 | const { toast } = useToast(); |
39 | | - const [searchParams] = useSearchParams(); |
40 | 38 | const [analysis, setAnalysis] = useState<TokenAnalysisResponse | null>(null); |
41 | 39 | const [hasAutoAnalyzed, setHasAutoAnalyzed] = useState(false); |
42 | 40 |
|
@@ -74,12 +72,13 @@ export default function Home() { |
74 | 72 |
|
75 | 73 | // Auto-analyze if token query param is present (from Analytics page "Analyze" buttons) |
76 | 74 | useEffect(() => { |
| 75 | + const searchParams = new URLSearchParams(window.location.search); |
77 | 76 | const tokenFromUrl = searchParams.get('token'); |
78 | 77 | if (tokenFromUrl && !hasAutoAnalyzed && tokenFromUrl.length >= 32 && tokenFromUrl.length <= 44) { |
79 | 78 | setHasAutoAnalyzed(true); |
80 | 79 | mutation.mutate(tokenFromUrl); |
81 | 80 | } |
82 | | - }, [searchParams, hasAutoAnalyzed]); |
| 81 | + }, [hasAutoAnalyzed]); |
83 | 82 |
|
84 | 83 | const getRiskColor = (score: number) => { |
85 | 84 | if (score >= 80) return "text-red-500"; |
|
0 commit comments