Improve app stability by fixing critical bugs and enhancing error handling

Fixes React Hooks violations, race conditions, and CORS security issues. Improves error logging and rate limit resilience.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: f4df1950-6410-48d0-b2de-f4096732504b
Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
pac7
2025-10-08 20:24:38 +00:00
parent b580db3fb0
commit 811b64a370

View File

@@ -4,7 +4,14 @@
ThrillWiki is a community-driven web application for discovering, reviewing, and tracking theme parks, rides, and related entities globally. Its core purpose is to provide a centralized platform for enthusiasts to research attractions and contribute to a collaborative knowledge base through user contributions and reviews, offering a comprehensive encyclopedia for the theme park world.
## Recent Changes
**October 2025 - Comprehensive Bug Analysis & Fixes (Latest)**
**October 2025 - Critical Bug Fixes & Stability Improvements (Latest)**
- **React Hooks Violation Fix**: Resolved critical hooks ordering issue in useSearch that caused app crashes during hot module reload (HMR) by using stable useMemo with entire options object as dependency
- **Race Condition Prevention**: Fixed stale data issues in useEntityVersions by capturing request IDs before async operations and using them consistently in error handlers
- **Enhanced Error Handling**: Improved notificationService with comprehensive error logging, validation, and consistent error message extraction across all edge function invocations
- **CORS Security Hardening**: Removed overly permissive wildcard fallback in upload-image edge function, added proper origin validation and detailed logging for development and production modes
- **Rate Limit Cleanup Resilience**: Added robust error handling to detect-location cleanup with failure tracking, emergency fallback mechanisms, and detailed logging to prevent memory leaks
**October 2025 - Comprehensive Bug Analysis & Fixes**
- **Rate Limiting Optimization**: Fixed detect-location edge function to only perform cleanup when adding new IPs at capacity, improving performance by short-circuiting existing entries
- **Null Safety**: Fixed PhotoSubmissionDisplay null reference errors by switching from !inner join to regular join with filtering
- **User-Facing Error Messages**: Added error state handling to useSearch and LocationSearch hooks, displaying user-friendly error messages instead of silent failures