Skip to content

[bug] Language 'All' filter still reverts to English — two-part fix needed #275

@realproject7

Description

@realproject7

Bug

Selecting "All languages" on the discovery page always reverts to English. PR #273 fixed part of this but PR #274 (custom dropdown) was based on an older branch and reverted the fix. Additionally, the filter component itself has a logic gap.

Root Cause — two issues

1. page.tsx fallback was reverted

PR #273 changed the lang fallback to allow "all", but PR #274 overwrote it back to:

const lang = rawLang && (LANGUAGES as readonly string[]).includes(rawLang) ? rawLang : "English";

"all" is not in LANGUAGES, so it's rejected → falls back to "English".

Fix: Re-apply the PR #273 fix:

const lang = rawLang === "all" ? "all" : rawLang && (LANGUAGES as readonly string[]).includes(rawLang) ? rawLang : "English";

2. LanguageFilter omits lang param when "all" is selected

In src/components/GenreLanguageFilter.tsx:

if (value !== "all") params.set("lang", value);

When "All languages" is selected, lang is not included in the URL. The page then loads with no lang param → defaults to English.

Fix: Always include lang when it's explicitly "all":

if (value !== "all") params.set("lang", value);
else params.set("lang", "all");

Or simplify to always set it: params.set("lang", value);

Files to modify

  • src/app/page.tsx — line 36: allow "all" as valid lang value
  • src/components/GenreLanguageFilter.tsx — always pass lang=all in URL when selected

Acceptance criteria

  • Selecting "All languages" shows stories in all languages
  • Default (no URL param) still shows English
  • Filter persists on page reload
  • npm run typecheck passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agentbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions