diff --git a/package-lock.json b/package-lock.json index 0890079b..4ee4675f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "simple-staking", - "version": "0.3.18", + "version": "0.3.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "simple-staking", - "version": "0.3.18", + "version": "0.3.20", "dependencies": { "@babylonlabs-io/btc-staking-ts": "0.3.0", "@bitcoin-js/tiny-secp256k1-asmjs": "2.2.3", diff --git a/package.json b/package.json index 24972a9a..5f699adf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-staking", - "version": "0.3.19", + "version": "0.3.20", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx b/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx index 84fa5cc2..6889d7e2 100644 --- a/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx +++ b/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx @@ -14,11 +14,19 @@ export const FinalityProviderSearch: React.FC = ({ const searchParams = useSearchParams(); const initialSearchFp = searchParams.get("fp"); - const [searchTerm, setSearchTerm] = useState(initialSearchFp); + const [searchTerm, setSearchTerm] = useState(initialSearchFp || ""); const debouncedSearchTerm = useDebounce(searchTerm, 300); + // Effect for handling initial search useEffect(() => { - onSearch(debouncedSearchTerm ?? ""); + if (initialSearchFp) { + onSearch(initialSearchFp); + } + }, [initialSearchFp, onSearch]); + + // Effect for handling subsequent searches + useEffect(() => { + onSearch(debouncedSearchTerm); }, [debouncedSearchTerm, onSearch]); const handleSearch = (e: React.ChangeEvent) => { @@ -34,7 +42,7 @@ export const FinalityProviderSearch: React.FC = ({