Fix unnecessary API calls and add route guards
Summary
- Add hive- prefix validation to prevent unnecessary getCommunity, getSubscribers, and getAccountNotifications API calls
- Add early return guards in user-profile and post page routes to prevent API calls when route params don't match expected username format (@ or %40 prefix)
- Prevents WaxError exceptions from invalid WASM calls on non-user routes like /trending/test
Additional fixes for #768 (closed)
Changes
- community-layout.tsx: Add enabled guard for 3 useQuery hooks
- prefetch-component.tsx: Change condition to startsWith check
- post-form.tsx: Add hive- prefix validation to enabled condition
- user-profile/layout.tsx: Add early returns for non-@ params
- [p2]/[permlink]/layout.tsx: Add early return for non-@ p2 params
- [p2]/[permlink]/page.tsx: Add notFound() for non-@ p2 params
Test plan
- Visit /trending/test - should not produce server errors
- Visit /trending/hive-123456 - should load community data
- Visit /@username - should load user profile
Generated with Claude Code