Docs Angular: Localhost 5010 Cache Error Fix

Fixed 'Outdated Optimize Dep' 504 errors preventing external browser access

Docs Angular: Localhost 5010 Cache Error Fix

Session: editor2-19.5
Date: January 5, 2026
Status: ✅ Fixed and Verified


🚨 Problem

The docs-angular app running on localhost:5010 was experiencing critical errors:

GET http://localhost:5010/@fs/Users/fguijarro/developer/repos/editor/.nx/cache/20.3.6/docs-angular/vite/deps/chunk-PFHFCCRN.js?v=16edb161 
net::ERR_ABORTED 504 (Outdated Optimize Dep)

Symptoms


🔍 Root Cause Analysis

The issue was caused by three interconnected problems:

1. Stale Vite Dependency Cache

2. Missing NGXS Type Declarations

// ❌ Before (caused TypeScript errors)
private readonly store = inject(Store);

// ✅ After (properly typed)
private readonly store: Store = inject(Store);

File: libs/libs-foundational/storage-system/src/angular/ngxs/ngxs-state-persistence.service.ts

3. Accidentally Deleted NGXS Packages


✅ Solution Applied

Step 1: Clear All Caches

# Clear NX cache
nx reset

# Remove Angular build cache
rm -rf dist/ .angular/

# Stop NX daemon
npx nx daemon --stop

# Clear Vite optimization cache
rm -rf .nx/cache

Step 2: Fix TypeScript Errors

File: libs/libs-foundational/storage-system/src/angular/ngxs/ngxs-state-persistence.service.ts

@Injectable({
  providedIn: 'root'
})
export class NgxsStatePersistenceService {
  private readonly store: Store = inject(Store);  // ✅ Added type annotation
  private readonly storage = inject(StorageService);
  // ... rest of the service
}

Step 3: Reinstall NGXS

yarn add @ngxs/store @ngxs/storage-plugin --ignore-engines

Installed versions:

Step 4: Restart Dev Server

yarn serve:docs:basic  # Runs: nx serve docs-angular

📊 Verification

Browser Console (After Fix)

✅ No errors - Clean initialization:

[vite] connected.
🚀 Intelligent Storage System Initializing
✅ Storage Registry: Initialization complete
✅ Generated 2104 dynamic routes
✅ Docs system initialized successfully

Server Status


🎯 Why It Happened

The "Outdated Optimize Dep" error is a Vite-specific issue that occurs when:

  1. Development server is running with optimized dependencies cached
  2. Dependencies change (package updates, cache corruption, etc.)
  3. Browser tries to load the cached optimized chunks
  4. Vite detects mismatch between requested version and cached version
  5. Server returns 504 indicating the optimization is outdated

The fix required clearing all three cache layers:


🔄 Files Modified

  1. libs/libs-foundational/storage-system/src/angular/ngxs/ngxs-state-persistence.service.ts
    • Added TypeScript type annotation to Store injection
    • Fixed: TS2339: Property 'select' does not exist on type 'unknown'

📝 Related Documentation


🚀 Future Improvements

Recommended: Migrate from NGXS to autoFlashState

The current implementation uses NGXS for state persistence in docs-angular, but the project has a more modern solution:

Current: NGXS + Storage Plugin
Recommended: autoFlashState from @storage-system

Benefits:

See: 19.5-ngxs-to-autoflashstate-migration-plan.md


✅ Status: Complete

The docs-angular app is now running correctly on localhost:5010 in all browsers with no errors.

Next Steps: Consider NGXS migration (see migration plan document)