Skip to content

Fix/farcaster miniapp environment detection#368

Merged
GigaHierz merged 4 commits into
celo-org:mainfrom
oyingrace:fix/farcaster-miniapp-environment-detection
Jun 1, 2026
Merged

Fix/farcaster miniapp environment detection#368
GigaHierz merged 4 commits into
celo-org:mainfrom
oyingrace:fix/farcaster-miniapp-environment-detection

Conversation

@oyingrace

Copy link
Copy Markdown
Contributor

Fix Farcaster Miniapp Environment Detection and Browser Compatibility Issues

Problem Summary
The Farcaster miniapp template had some issues when running in non-mini app browser environments:

Before Fix Issues:

  1. Endless "Connecting..." state in regular browsers (not Farcaster miniapp environment)
  2. Incorrect authentication status - always showed "You are signed in!" regardless of actual state
  3. Hardcoded wallet address - displayed fake address 0x1e4B...605B when no wallet was connected
  4. Poor environment detection - couldn't distinguish between Farcaster miniapp vs regular browser
  5. TypeScript errors - result.added property didn't exist on SDK return type

Solution Overview

  1. Implemented comprehensive environment-aware logic that:
  2. Detects Farcaster miniapp environment using actual user data availability
  3. Prevents auto-wallet connection in non-miniapp environments
  4. Shows accurate authentication status based on real user data
  5. Displays proper wallet connection states without hardcoded values
  6. Fixes TypeScript errors in SDK integration

Visual Changes
Before Fix:
❌ Shows "You are signed in!" even in regular browser
❌ Wallet status stuck on "Connecting..." indefinitely
❌ Displays hardcoded wallet address 0x1e4B...605B
❌ No distinction between environments

Screenshot 2025-09-20 at 12 20 16 PM

After Fix:
✅ Shows "You are not signed in" in regular browser
✅ Shows "You are signed in!" only when actually authenticated
✅ Wallet status shows "Not Connected" with "No wallet connected"
✅ Proper environment detection and state management

Screenshot 2025-09-20 at 12 28 15 PM

Testing
✅ Template Generation: Successfully created test project with --template farcaster-miniapp
✅ TypeScript Compilation: No type errors in generated code
✅ Environment Detection: Correctly identifies Farcaster miniapp vs browser
✅ State Management: Proper wallet and authentication status handling
✅ Cross-Environment: Works in both Farcaster miniapp and regular browser

Files Changed

  • templates/base/apps/web/src/app/page.tsx.hbs - Main template file with all fixes

@oyingrace oyingrace marked this pull request as ready for review September 20, 2025 12:32
@GigaHierz GigaHierz merged commit 710dd89 into celo-org:main Jun 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants