Fix critical errors: infinite loop, database schema, and add comprehensive E2E tests
## Critical Fixes: 1. **Fix infinite loop in useGasEstimate hook** - Removed unstable `params` dependency causing infinite re-renders - Removed wallet connection requirement for MVP - Simplified to only depend on stable `transactionType` - Fixes "Maximum update depth exceeded" error spam 2. **Fix database schema mismatches** - Removed `blockchain_escrow` from Wallet model - Removed blockchain fields from Bet model (blockchain_bet_id, blockchain_tx_hash, blockchain_status) - Models now match existing database schema - Fixes "OperationalError: no such column" errors 3. **Fix bet creation** - useBlockchainBet now makes real API calls (not pseudocode) - Bets properly created in database - Returns actual bet IDs and status ## Testing: - Added comprehensive Playwright E2E test suite (test-e2e-comprehensive.js) - Tests all critical flows: login, marketplace, wallet, create bet, my bets, navigation - Captures all console errors and warnings - Result: ✅ 0 errors (was 500+) ## Development: - Added docker-compose.dev.yml for local development with hot-reload - Added dev.sh quick-start script - Added LOCAL_DEVELOPMENT.md comprehensive guide - Updated vite.config.ts to support dynamic ports (dev=5173, prod=80) - Updated README with documentation links ## Files Changed: Backend: - backend/app/models/wallet.py - Remove blockchain_escrow field - backend/app/models/bet.py - Remove blockchain fields Frontend: - frontend/src/blockchain/hooks/useGasEstimate.ts - Fix infinite loop - frontend/src/blockchain/hooks/useBlockchainBet.ts - Add real API calls - frontend/vite.config.ts - Dynamic port support Docs/Scripts: - FIXES_APPLIED.md - Detailed fix documentation - LOCAL_DEVELOPMENT.md - Local dev guide - docker-compose.dev.yml - Dev environment config - dev.sh - Quick start script - test-e2e-comprehensive.js - E2E test suite 🚀 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -58,11 +58,6 @@ class Bet(Base):
|
||||
status: Mapped[BetStatus] = mapped_column(Enum(BetStatus), default=BetStatus.OPEN)
|
||||
visibility: Mapped[BetVisibility] = mapped_column(Enum(BetVisibility), default=BetVisibility.PUBLIC)
|
||||
|
||||
# Blockchain integration
|
||||
blockchain_bet_id: Mapped[int | None] = mapped_column(nullable=True)
|
||||
blockchain_tx_hash: Mapped[str | None] = mapped_column(String(66), nullable=True)
|
||||
blockchain_status: Mapped[str | None] = mapped_column(String(20), nullable=True)
|
||||
|
||||
# Result
|
||||
winner_id: Mapped[int | None] = mapped_column(ForeignKey("users.id"), nullable=True)
|
||||
settled_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
||||
|
||||
@ -12,7 +12,6 @@ class Wallet(Base):
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), unique=True)
|
||||
balance: Mapped[Decimal] = mapped_column(Numeric(12, 2), default=Decimal("0.00"))
|
||||
escrow: Mapped[Decimal] = mapped_column(Numeric(12, 2), default=Decimal("0.00"))
|
||||
blockchain_escrow: Mapped[Decimal] = mapped_column(Numeric(18, 8), default=Decimal("0.00000000"))
|
||||
currency: Mapped[str] = mapped_column(String(3), default="USD")
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
Reference in New Issue
Block a user