[PR #13109] fix(web): sync docs locale cookie on alias redirects #14511

Closed
opened 2026-02-16 18:19:18 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13109

State: closed
Merged: Yes


Closes #13108 #13078 #13057

What does this PR do?

This fixes docs locale reversion when users explicitly navigate via locale aliases (especially /docs/en) while an existing non-English oc_locale cookie is set.
I updated docs middleware to set oc_locale on alias redirects, and normalize root English to oc_locale=en.
I also synced locale changes to oc_locale in app language context so cookie/state stay aligned.
Why this works: docs routing reads oc_locale when deciding redirects from /docs. If cookie and user-selected locale drift, users can bounce back to a previous non-English locale. Keeping cookie synchronized removes that drift.
Note: production /docs/en returning 404 appears to be a front-door routing issue. This PR improves locale consistency once requests reach app/docs logic.

How did you verify your code works?

  • Reproduced and checked behavior locally with oc_locale set to non-English values (not only ko).
  • Verified /docs/ alias redirect behavior and cookie updates in local docs middleware flow.
  • Confirmed changed files are:
    • packages/web/src/middleware.ts
    • packages/app/src/context/language.tsx
  • Checked production headers for context:
    • /docs/en returns 404
    • /docs returns 200
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13109 **State:** closed **Merged:** Yes --- Closes #13108 #13078 #13057 ### What does this PR do? This fixes docs locale reversion when users explicitly navigate via locale aliases (especially /docs/en) while an existing non-English oc_locale cookie is set. I updated docs middleware to set oc_locale on alias redirects, and normalize root English to oc_locale=en. I also synced locale changes to oc_locale in app language context so cookie/state stay aligned. Why this works: docs routing reads oc_locale when deciding redirects from /docs. If cookie and user-selected locale drift, users can bounce back to a previous non-English locale. Keeping cookie synchronized removes that drift. Note: production /docs/en returning 404 appears to be a front-door routing issue. This PR improves locale consistency once requests reach app/docs logic. ### How did you verify your code works? - Reproduced and checked behavior locally with oc_locale set to non-English values (not only ko). - Verified /docs/<locale> alias redirect behavior and cookie updates in local docs middleware flow. - Confirmed changed files are: - packages/web/src/middleware.ts - packages/app/src/context/language.tsx - Checked production headers for context: - /docs/en returns 404 - /docs returns 200
yindo added the pull-request label 2026-02-16 18:19:18 -05:00
yindo closed this issue 2026-02-16 18:19:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14511