Docs Angular Connectivity Improvements

Documentation for Sessions

S238.6–7: Docs-Angular Local/Cloud Connectivity Improvements

Session: 238.6, 238.7
Date: 2026-03-19
Focus: Fix connectivity between local files, cloud files/projects in docs-angular (MongoDB backend)


S238.7: Cloud File Manager UI Fix (MongoDB Data Model)

Problem: Backend connected successfully (629 files loaded) but UI showed 0 projects and empty files.

Root cause: CloudTransferService expected the old data model (files embedded in projects). MongoDB backend returns:

Fix: Rewrote refreshCloudData() to:

  1. Fetch all files via getAllFilesPaginated() (paginates through API)
  2. Derive projects from file paths when doc-projects empty (english/GoGrab-Space from path)
  3. Map DocFile → CloudFile and populate project.structure
  4. Use folders-config for display names when available
  5. Fix downloadFile to use file content (or DocsApiService) instead of deprecated StorageService
  6. Fix uploadFile path format: english/GoGrab-Space/filename.md
  7. Fix createCloudProject to send DocProject schema (name, displayName, isRoot, language)

S238.6: Root Cause Analysis (from screenshots)

  1. MIME type errors — Chunks (chunk-*.js) returned HTML instead of JavaScript

    • Cause: _redirects had /* /index.html 200 which rewrote ALL requests (including static assets) to index.html
    • Fix: Removed the catch-all redirect. docs-angular uses hash routing (#/admin/cloud), so the server only receives / and static asset requests — no SPA fallback needed
  2. Cloud service / View Sessions 404 — "Failed to load view sessions", "Failed to create view session"

    • Cause: backend-docs-api at docs-api.gograb.space may be unreachable (not deployed, CORS, or network)
    • Fix: Improved error handling and user feedback; clearer status messages
  3. DocsApiService healthCheck — Fragile URL construction

    • Fix: Simplified to use ${apiUrl}/health when apiUrl already ends with /docs-api

Changes Made

File Change
apps/docs-angular/public/_redirects Removed /* /index.html 200 — was breaking chunk loading
apps/docs-angular/src/app/services/docs-api.service.ts Simplified healthCheck() URL construction
apps/docs-angular/src/app/admin/view-sessions/view-sessions.component.ts Added loadError signal, error UI with retry, clearer 404 message
apps/docs-angular/src/app/admin/view-sessions/view-sessions.component.scss Added .error-hint styling
apps/docs-angular/src/app/admin/components/cloud-file-manager/cloud-file-manager.component.ts Improved status message and console hint when backend unreachable

Deployment Checklist

  1. Redeploy docs-angular to Cloudflare Pages:

    yarn deploy:docs
    # or: ./tools/scripts/deploy-docs.sh
    
  2. Verify backend-docs-api is deployed and reachable:

    curl https://docs-api.gograb.space/docs-api/health
    
    • If 404/connection refused: deploy backend-docs-api to Railway (or your hosting)
    • Ensure docs-api.gograb.space DNS points to the backend
  3. Verify production branch in Cloudflare Pages:

    • Project gograb-docs should use branch deploy/docs for production
    • Custom domain docs.gograb.space should map to that deployment
  4. After deploy: Hard refresh (Cmd+Shift+R) to clear cached HTML/chunks


References