[PR #3292] [CLOSED] fix: language switching redirects to deep agents overview instead of equivalent page #3352

Closed
opened 2026-06-05 18:22:49 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/3292
Author: @mdrxy
Created: 3/24/2026
Status: Closed

Base: mainHead: open-swe/6ebd0fb3-6771-390a-213d-7f7ca025e7c8


📝 Commits (4)

  • ba3d953 fix: persist language toggle state in sessionStorage and fix dropdown selector
  • 0e164a5 fix: eliminate flicker during language switch by intercepting pushState before render
  • afd7875 fix: rewrite dropdown hrefs via MutationObserver for zero-flicker language switching
  • 068008a fix: use capture-phase click interception + Next.js router for zero-flicker language switching

📊 Changes

1 file changed (+42 additions, -106 deletions)

View changed files

📝 src/language-toggle.js (+42 -106)

📄 Description

Description

Fixes the language toggle (Python ↔ TypeScript) in the OSS docs sidebar. Switching languages from e.g. /oss/javascript/integrations/chat/fireworks was landing on the Deep Agents overview instead of the equivalent Python page.

Root causes: (1) Mintlify re-executes custom JS on each client-side navigation, so the in-memory previousUrl was reset to null before the redirect logic could use it — fixed by persisting in sessionStorage. (2) The click handler selector [data-dropdown-item] doesn't exist in current Mintlify HTML — updated to .nav-dropdown-item. (3) History API patches were stacking on re-execution — added a window.__langTogglePatched guard.

Test Plan


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/3292 **Author:** [@mdrxy](https://github.com/mdrxy) **Created:** 3/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `open-swe/6ebd0fb3-6771-390a-213d-7f7ca025e7c8` --- ### 📝 Commits (4) - [`ba3d953`](https://github.com/langchain-ai/docs/commit/ba3d9535f1e8243f150a55181816c76b625c5f77) fix: persist language toggle state in sessionStorage and fix dropdown selector - [`0e164a5`](https://github.com/langchain-ai/docs/commit/0e164a56e235bbc9629852411ef2e311f3229a85) fix: eliminate flicker during language switch by intercepting pushState before render - [`afd7875`](https://github.com/langchain-ai/docs/commit/afd787547eb6bd78cb36cf50214be15a823228c2) fix: rewrite dropdown hrefs via MutationObserver for zero-flicker language switching - [`068008a`](https://github.com/langchain-ai/docs/commit/068008ab07dbe945ecc2f798bda86f8f9d900cf1) fix: use capture-phase click interception + Next.js router for zero-flicker language switching ### 📊 Changes **1 file changed** (+42 additions, -106 deletions) <details> <summary>View changed files</summary> 📝 `src/language-toggle.js` (+42 -106) </details> ### 📄 Description ## Description Fixes the language toggle (Python ↔ TypeScript) in the OSS docs sidebar. Switching languages from e.g. `/oss/javascript/integrations/chat/fireworks` was landing on the Deep Agents overview instead of the equivalent Python page. Root causes: (1) Mintlify re-executes custom JS on each client-side navigation, so the in-memory `previousUrl` was reset to `null` before the redirect logic could use it — fixed by persisting in `sessionStorage`. (2) The click handler selector `[data-dropdown-item]` doesn't exist in current Mintlify HTML — updated to `.nav-dropdown-item`. (3) History API patches were stacking on re-execution — added a `window.__langTogglePatched` guard. ## Test Plan - [ ] From https://docs.langchain.com/oss/javascript/integrations/chat/fireworks, click "Python" in the language dropdown — should navigate to `/oss/python/integrations/chat/fireworks` - [ ] From a Python page, click "TypeScript" — should navigate to the equivalent JS page - [ ] Verify hash anchors are preserved when switching languages --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:22:49 -04:00
yindo closed this issue 2026-06-05 18:22:49 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#3352