Docs
Protocol Verified

[FIX-004] Sandbox Route Mismatch

Implementing a dual-mode loader to handle URL parsing in proxy environments.

PRID: 1114
VERIFIED
1 min read

[FIX-004] Route Mismatch in Sandbox Proxy Environments

📝 Problem Background

In the AI Studio preview window (Blob protocol), multi-level doc paths (like /docs/core/plan) were incorrectly parsed by TanStack Router as a single splat *, preventing the detail page from reading the slug.

🧪 Effort Metrics

  • Attempt Count: 5
  • Time Spent: 1.5 hours
  • Complexity: ⭐⭐⭐⭐ (Hard)

🔍 Root Cause Analysis

AI Studio previews run through multiple proxies, restricting the behavior of the browser's History API. In this non-standard host mode, traditional regex-based path parsing leads to "parameter hallucinations."

🛠️ Fix Strategy

Dual-Mode Content Discovery Protocol:

  • Production Environment: Continues to trust params for O(1) lookups.
  • Sandbox Environment: Automatically degrades to a "Dictionary Scanner." It reads the raw window.location.href string and performs a "greedy match" (sorted by slug length, descending) against a statically generated manifest to forcibly retrieve the correct ID.

Effect: Completely resolved routing failures caused by URL injection of .html or blob: prefixes.

Authority Distribution

Share this technical artifact