Privy Popup Blocking
Browser popup blocking can affect users using social login (Privy) when operations delay the signing popup.
Problem
When using Privy for social login (cross-app connection), browsers may block the confirmation popup if there's a delay between user action and popup trigger.
What Causes This
Fetching data after button click
API calls before signing
Any async operations between click and popup
Solution
Pre-fetch Data Before Transaction
Ensure all required data is loaded before the user clicks the button:
// β
Good: Pre-fetch data
const { data } = useQuery(['someData'], fetchSomeData);
const sendTx = () => sendTransaction(data);
// β Bad: Fetching data during the transaction
const sendTx = async () => {
const data = await fetchSomeData(); // This delay causes popup blocking
return sendTransaction(data);
};Best Practices
Load Data Early
Show Loading States
Avoid Async in Click Handlers
Testing
To test if your implementation avoids popup blocking:
Use social login (Privy)
Click transaction buttons
Popup should appear immediately
No browser blocking warnings
Common Scenarios
Form submissions: Validate and prepare data before
submitbutton is enabledToken approvals: Pre-fetch allowance amounts
Multi-step transactions: Load all data for subsequent steps upfront
Was this helpful?