Skip to content

Language Bars always shows four languages #358

Closed

Description

@prakashNalla

Describe the bug
Language Bars always shows four languages. Each slot falls back to its default with || (src/templates/github/language-bars.ts:44-49), so clearing Language 3 and Language 4 brings back CSS 8.3% and Other 5.2%. A repo with two or three languages can't be shown.

To Reproduce

  1. Open the Language Bars template in the editor
  2. Set Language 1 to Go / 81.0% and Language 2 to Shell / 19.0%
  3. Clear Language 3, Percentage 3, Language 4 and Percentage 4
  4. The legend still lists CSS 8.3% and Other 5.2%, and the bar has their segments

Expected behavior
Only Go and Shell, with the bar split 81/19.

Actual behavior
Go 81.0% · Shell 19.0% · CSS 8.3% · Other 5.2%

Environment

  • Browser: Chrome
  • OS: macOS

Additional context
Since #217 a cleared field reaches the template as an empty string, so the template is the one putting the default back.

Activity

  1. prakashNalla commented on Oct 31, 2026

    @prakashNalla
    CollaboratorAuthor

    @anurag629 I'd like to fix this one if it makes sense to you. Plan: fall back to the default only when a language's field is missing, skip slots whose name is empty, and add a test in tests/templates/. I'm at two right now (toolbelt#440 and #349), so whenever one of those is merged.

  2. prakashNalla commented on Oct 31, 2026

    @prakashNalla
    CollaboratorAuthor

    @anurag629 codercops/toolbelt#441 is merged, so I'm free for this one. The fix is ready.

  3. added
    bugSomething isn't working
    hacktoberfestGood pick for Hacktoberfest contributors
    on Oct 31, 2026
  4. anurag629 commented on Oct 31, 2026

    @anurag629
    Member

    Hey @prakashNalla, confirmed, the || fallbacks bring the defaults back for every cleared slot. It's yours, so with #349 that's your two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghacktoberfestGood pick for Hacktoberfest contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions