Date: April 9, 2026
Status: ✅ RESOLVED
Priority: MEDIUM
Affected: Entire site (Home, About, Portfolio, Posts), UI visibility
- Elements using the
useScrollRevealhook were sporadically staying invisible (opacity-0). - Affected critical sections like Search Bar, Tag Cloud, and "Latest Articles".
- The hook failed to trigger if elements were already above the fold on load or if the page was too short to scroll.
- Strict Threshold: Default
0.15(15%) required too much of the element to be visible before triggering. - Negative Root Margin:
-40pxprevented elements near the edges from revealing. - No Initial Check: The hook only waited for a scroll event/intersection change and didn't check if the element was already visible on mount.
Refactored the global client/src/hooks/useScrollReveal.ts hook to be bulletproof:
- Callback Ref Implementation: Changed the hook to use a
useStatefor the DOM element instead ofuseRef. This ensures the hook reacts immediately when an element mounts, even if it was behind a loading state (e.g.,if (isLoading) return ...). - Multi-Layered Fallbacks: Added
getBoundingClientRect()checks inside auseEffect. It checks once immediately on mount, and then at 50ms, 250ms, and 1000ms intervals to handle cases where layout shifts or slow-loading content might move an element into view. - Scroll Listener Fallback: Added a window
scrolllistener as a final safeguard to guarantee elements reveal the moment a user interacts with the page. - Zero Threshold: Changed threshold to
0so the reveal starts as soon as a single pixel enters the frame. - Positive Root Margin: Changed to
50pxso animations trigger slightly before the user reaches them for a smoother experience.
client/src/hooks/useScrollReveal.ts- Core hook logic refactored with callback refs.client/src/pages/posts.tsx- Removed temporary hardcoded visibility fixes in favor of the now-working global hook.
- ALWAYS use the
useScrollRevealhook for fade-in animations rather than custom timeouts or hardcoded logic. - NEVER assume
useRefwill capture elements that are conditionally rendered after an initial mount; use the callback ref pattern inuseScrollReveal. - TEST elements behind loading states (like Blog Grid or Featured Stories) to ensure they reveal correctly once data arrives.
Date: January 20, 2025
Status: ✅ RESOLVED
Priority: CRITICAL
Affected: Edit post page (/edit-post/:id), admin functionality
- Edit post page crashing with React error #310
- Console showing "Rendered more hooks than during the previous render"
- "Rules of Hooks" violation preventing page from loading
- All form fields (title, content, tags, excerpt, featured image) not visible
- Early conditional returns before hooks -
if (isEditing && isLoading)andif (isEditing && error)happening before all React hooks were called - Inconsistent hook order - Hooks being called in different orders between renders
- Rules of Hooks violation - React expects all hooks to be called in the same order every time
BEFORE (BROKEN):
export default function CreatePost() {
const { id } = useParams<{ id?: string }>();
const [, setLocation] = useLocation();
// Early return before all hooks - VIOLATES RULES OF HOOKS
if (isEditing && isLoading) {
return <LoadingSpinner />;
}
// More hooks called after conditional return
const { data: post, isLoading, error } = useQuery({...});
const autoSaveMutation = useMutation({...});
// ... more hooks
}AFTER (WORKING):
export default function CreatePost() {
// ✅ ALL HOOKS CALLED FIRST, BEFORE ANY CONDITIONAL LOGIC
const { id } = useParams<{ id?: string }>();
const [, setLocation] = useLocation();
const queryClient = useQueryClient();
const { data: post, isLoading, error } = useQuery({...});
const autoSaveMutation = useMutation({...});
const saveMutation = useMutation({...});
useEffect(() => {...}, [isEditing, post]);
useEffect(() => {...}, [initialValues]);
// ✅ Helper functions after hooks
const handleAutoSave = async (data) => {...};
const handleSave = async (data) => {...};
// ✅ Conditional rendering after all hooks
if (isEditing && isLoading) return <LoadingSpinner />;
if (isEditing && error) return <ErrorState />;
return <MainEditor />;
}- All hooks moved to top of component
- No conditional returns before hooks
- Helper functions defined after hooks
- Conditional rendering happens last
client/src/pages/create-post.tsx- Restructured hook order and component flow
# Test edit post page
1. Navigate to /edit-post/5230605364
2. Check console - no React errors
3. Verify all form fields are visible
4. Test auto-save functionality
5. Confirm no "Rules of Hooks" violations- NEVER put conditional returns before hooks - always call all hooks first
- NEVER call hooks inside loops, conditions, or nested functions
- ALWAYS call hooks in the same order every render
- ALWAYS test hook consistency - check for "Rendered more hooks" errors
- ALWAYS follow React's Rules of Hooks - they are not suggestions, they are requirements
- Added comprehensive documentation in PRD.md
- Created verification steps for hook consistency
- Documented the fix pattern for future reference
Date: June 28, 2025
Status: ✅ RESOLVED
Priority: CRITICAL
Affected: Admin dashboard, blog posts API endpoints
- Admin dashboard showing error:
Unexpected token '<', "<!DOCTYPE "... is not valid JSON - API endpoints
/api/admin/blog-postsreturning HTML instead of JSON - All API functions (TypeScript) returning 404 errors
- Admin interface unable to load posts
- Missing
@vercel/nodedependency - Required for TypeScript API functions in Vercel - Complex
vercel.jsonrouting configuration - Interfering with Vercel's auto-detection - Build configuration conflicts - Manual builds overriding zero-config approach
npm install @vercel/nodeBEFORE (BROKEN):
{
"version": 2,
"builds": [
{
"src": "api/**/*.ts",
"use": "@vercel/node"
},
{
"src": "package.json",
"use": "@vercel/static-build",
"config": {
"distDir": "dist"
}
}
],
"routes": [
// Complex routing rules that interfered with API detection
]
}AFTER (WORKING):
{
"version": 2,
"buildCommand": "npm run build",
"outputDirectory": "dist"
}- Removed manual builds configuration
- Enabled zero-config approach for API routes
- Vercel now automatically compiles TypeScript API functions
vercel.json- Simplified configurationpackage.json- Added@vercel/nodedependencyapi/admin/blog-posts.ts- Enhanced error handling and debugging
# Test API endpoint
curl -H "Accept: application/json" https://your-domain.vercel.app/api/admin/blog-posts
# Expected: JSON response with blog posts array
# Before fix: HTML error page- NEVER remove
@vercel/nodefrom package.json - NEVER add complex routing to vercel.json - Use zero-config approach
- NEVER manually specify API builds - Let Vercel auto-detect
- ALWAYS test API endpoints after deployment changes
- ALWAYS check this log before modifying Vercel configuration
- Added comprehensive error handling to API functions
- Documented zero-config approach as the standard
- Created this fix log for future reference
Date: June 28, 2025
Status: ✅ RESOLVED
Priority: CRITICAL
Affected: Blog frontend, public post display, home page featured posts
- Blog frontend unable to load posts from
/api/blog-postsendpoint - Frontend calling non-existent public API endpoints
- Only admin endpoints (
/api/admin/blog-posts) were working - Public blog features completely broken (posts grid, featured posts, individual posts)
Missing Public API Functions: The project had two types of endpoints:
- ✅ Admin endpoints (
/api/admin/blog-posts) - Working (Vercel functions existed) - ❌ Public endpoints (
/api/blog-posts) - Missing (No Vercel functions created)
The frontend was calling public endpoints that didn't exist as Vercel API functions. The endpoints were defined in server/routes.ts (Express server) but no corresponding Vercel API functions existed.
/api/blog-posts- Main posts list for blog grid/api/blog-posts/featured- Featured posts for homepage/api/blog-posts/[identifier]- Individual posts by slug/ID/api/blog-posts/[id]/related- Related posts
// Key features:
- MongoDB connection and data mapping
- Filtered for published posts only (draft: { $ne: true })
- Support for query parameters (featured, category, limit, offset)
- Proper CORS headers and error handling
- Unique ID generation and deduplication// Key features:
- Supports both slug and numeric ID lookup
- Multiple ID resolution strategies (explicit ID, generated from ObjectId)
- Published posts only filtering
- Proper TypeScript type handling
- Comprehensive error handling- ✅
/api/blog-posts- Returns all published posts with full data - ✅
/api/blog-posts?featured=true- Returns only featured posts - ✅
/api/blog-posts/[slug]- Returns individual posts by slug - ✅ All endpoints return proper JSON with complete post data
# Test main posts endpoint
curl -H "Accept: application/json" https://your-domain.vercel.app/api/blog-posts
# Test featured posts
curl -H "Accept: application/json" https://your-domain.vercel.app/api/blog-posts?featured=true
# Test individual post by slug
curl -H "Accept: application/json" https://your-domain.vercel.app/api/blog-posts/your-post-slug- NEVER assume frontend endpoints exist without verification
- ALWAYS create both admin AND public API functions
- ALWAYS test all endpoints the frontend calls
- REMEMBER: Server routes ≠ Vercel API functions
- CHECK frontend network requests to identify missing endpoints
- Created:
api/blog-posts.ts(public posts list) - Created:
api/blog-posts/[identifier].ts(individual posts) - Dependency: Used existing
@vercel/nodepackage - Database: Used existing MongoDB configuration
This project uses dual API architecture:
- Admin APIs (
/api/admin/*) - Full CRUD, drafts included - Public APIs (
/api/*) - Read-only, published content only
When adding features, ALWAYS create both admin and public endpoints as needed.
Date: June 28, 2025
Status: ✅ RESOLVED
Priority: HIGH
Affected: Admin dashboard, all React SPA routes (admin, posts, etc.)
- Admin dashboard at
/adminreturning 404 errors on Vercel deployment - React SPA routes not working on production (but working locally)
- Users unable to access admin interface for content management
- All frontend routes except root
/inaccessible
Missing SPA Routing Configuration: When we simplified vercel.json to fix API issues in FIX #001, we removed the SPA routing configuration that React needs.
How React SPA Routing Works:
- React apps are Single Page Applications - all routes are handled client-side
- When user visits
/admin, server must serveindex.htmland let React Router handle it - Without proper Vercel routing config,
/adminreturns 404 because no physical file exists
What Was Missing:
- Route configuration to catch all URLs and serve
index.html - Proper handling of filesystem requests (API, assets, etc.)
BEFORE (BROKEN - Missing SPA Routes):
{
"version": 2,
"buildCommand": "npm run build",
"outputDirectory": "dist"
}AFTER (WORKING - With SPA Routing):
{
"version": 2,
"buildCommand": "npm run build",
"outputDirectory": "dist",
"routes": [
{
"src": "/googlec3cfbe8ec5429358.html",
"dest": "/googlec3cfbe8ec5429358.html"
},
{
"handle": "filesystem"
},
{
"src": "/(.*)",
"dest": "/index.html"
}
]
}- Static Files First: Serves Google verification file directly
- Filesystem Handling: Serves API routes, assets, and static files
- SPA Fallback: Any other route serves
index.htmlfor React Router
- ✅
/admin- Main admin dashboard - ✅
/admin/seo- SEO performance dashboard - ✅
/create-post- Advanced post editor - ✅
/edit-post/:id- Post editing interface - ✅ All other React Router routes
# Test admin page (should return HTML, not 404)
curl -I https://your-domain.vercel.app/admin
# Test API still works (should return JSON)
curl https://your-domain.vercel.app/api/blog-posts
# Test SPA routes work
curl -I https://your-domain.vercel.app/posts
curl -I https://your-domain.vercel.app/create-post- NEVER remove SPA routing from vercel.json - React apps require it
- ALWAYS test both API endpoints AND frontend routes after deployment
- REMEMBER: API routes ≠ SPA routes - Both need different handling
- SPA routing pattern:
"src": "/(.*)", "dest": "/index.html"is essential - Order matters: Static files → Filesystem → SPA fallback
- Modified:
vercel.json- Added SPA routing configuration - Dependency: Maintains API auto-detection from FIX #001
This project requires dual routing architecture:
- API Routes: Auto-detected by Vercel (files in
/api/) - SPA Routes: Configured in
vercel.jsonto serve React app
Both are essential - removing either breaks functionality.
Date: June 28, 2025
Status: 🔄 IN PROGRESS
Priority: HIGH
Affected: Individual blog posts
The individual blog post API endpoint /api/blog-posts/[slug].ts returns 404 on deployed version, causing blog post pages to show "Article Not Found". Works correctly on localhost.
- Vercel Function Detection Issue: Dynamic route not being recognized as valid serverless function
- Deployment Configuration: Possible issue with how Vercel handles dynamic routes in TypeScript
- File Naming Convention: Square bracket naming might not be properly detected during build
- ✅ Main API endpoints working (
/api/blog-posts,/api/admin/blog-posts) - ❌ Dynamic route
/api/blog-posts/[slug]returns generic 404 - ✅ Local development works correctly
- 🔄 Investigating Vercel dynamic route requirements
- Renamed from
[identifier].tsto[slug].ts - Verified proper export structure (
export default async function handler) - Ensured file is properly committed and deployed
- Confirmed routing configuration allows API routes
- Research Vercel dynamic route requirements for TypeScript functions
- Consider alternative routing approaches
- Test with simpler dynamic route patterns
- Blog post URLs work on localhost but fail on deployed site
- Users see "Article Not Found" for valid blog posts
- SEO and sharing functionality broken for individual posts
- Replaced Dynamic Routes with Query Parameters:
- Removed problematic
/api/blog-posts/[slug].ts - Created
/api/blog-post.tswith query parameter support (?slug=or?id=)
- Removed problematic
- Updated Frontend API Calls:
- Changed from
/api/blog-posts/${slug}to/api/blog-post?slug=${slug}
- Changed from
- Simplified API Structure: Moved individual post endpoint to root API directory
- Maintained Backward Compatibility: Supports both slug and ID parameters
// New working endpoint
GET /api/blog-post?slug=post-slug-here
GET /api/blog-post?id=123456789
// Old broken endpoint (removed)
GET /api/blog-posts/[slug]- ✅
https://tech-san.vercel.app/api/blog-post?slug=first-week-of-internship-tip-precision-and-quick-communication-has-needed→ Returns correct JSON - ✅ Blog post pages now load correctly on deployed site
- ✅ Local development continues to work
- Avoid Nested Dynamic Routes: Use root-level API files for dynamic content
- Prefer Query Parameters: More reliable than path parameters for Vercel deployment
- Test Deployed APIs Separately: Always test API endpoints directly before testing frontend
- Use Simple API Structure: Keep dynamic endpoints in
/api/root directory
For future API endpoints requiring dynamic content:
✅ Good: /api/endpoint.ts with ?param=value
❌ Avoid: /api/nested/[param].ts
Date: April 9, 2026
Status: ✅ RESOLVED
Priority: MEDIUM
Affected: Entire site, specifically List views and Post transitions
- Initial page loads for list views (Home, /posts) were slow due to large API payloads (transferring full Markdown content for all posts).
- Transitions from list views to individual articles felt sluggish due to waiting for single-post API calls.
- API Payload Optimization: Modified
api/posts.tsto strip the heavycontentfield from all list-based and featured post responses. This reduced the average payload size by >90%. - Hover-Based Prefetching: Implemented background preloading in
PostsPage,BlogGrid, andFeaturedStories. Full article data is now fetched as soon as a user hovers over a link, making the final click-to-transition feel instantaneous.
api/posts.ts- Optimized MongoDB mapping for list views.client/src/pages/posts.tsx- Added prefetching to the main list.client/src/components/blog-grid.tsx- Added prefetching to homepage articles.client/src/components/featured-stories.tsx- Added prefetching to featured stories.
- NEVER return full content in list APIs; only return metadata, excerpts, and IDs.
- ALWAYS use
queryClient.prefetchQueryon hover for high-traffic links to provide an "instant" feel.
Date: [Date]
Status: [RESOLVED/IN PROGRESS/MONITORING]
Priority: [CRITICAL/HIGH/MEDIUM/LOW]
Affected: [What was broken]
[Detailed description of the issue]
[What caused the problem]
[How it was fixed]
[List of changed files]
[What to never do again]
# Test blog posts API
curl -H "Accept: application/json" https://your-domain.vercel.app/api/admin/blog-posts
# Test with local development
npm run dev
curl http://localhost:3000/api/admin/blog-posts# 1. Always test locally first
npm run dev
# 2. Check TypeScript compilation
npm run check
# 3. Build locally to verify
npm run build
# 4. Deploy with our script
npm run deploy
# 5. Test API endpoints immediately after deployment# If deployment breaks, immediately revert vercel.json to working state:
git checkout HEAD~1 vercel.json
vercel --prod@vercel/node- Required for TypeScript API functionsmongodb- Database connectioncors- API CORS handling
- API returning HTML instead of JSON
- 404 errors on
/api/*routes Unexpected token '<'errors in frontend- Vercel build warnings about unused build settings
- Admin dashboard not loading posts
Last Updated: June 28, 2025
Next Review: [Set monthly review date]