Skip to content

fix(filters): pin filter sort to a stable locale#2844

Merged
setchy merged 1 commit intogitify-app:mainfrom
BlueManCZ:fix/deterministic-filter-sort
May 6, 2026
Merged

fix(filters): pin filter sort to a stable locale#2844
setchy merged 1 commit intogitify-app:mainfrom
BlueManCZ:fix/deterministic-filter-sort

Conversation

@BlueManCZ
Copy link
Copy Markdown
Contributor

Summary

  • Filter checkbox order in FilterSection is sorted via localeCompare() + toLocaleLowerCase(), both of which fall back to the host locale. This makes the resulting order machine-dependent.
  • Under cs_CZ.UTF-8 (Czech), for example, "Check Suite" sorts after "Co..." and "De..." entries because Czech treats "ch" as a digraph that collates after "h". This causes the SubjectTypeFilter and Filters snapshot tests to fail locally for non-English contributors while CI (which runs in English) keeps passing — the snapshot was effectively captured against a host-locale-specific order.
  • Pin the comparator to 'en' and switch toLocaleLowerCase()toLowerCase() so the order is stable across machines. Filter type labels are hardcoded English strings (no i18n in this app), so sorting them in English is also semantically correct.

Test plan

  • pnpm test passes locally under a non-English locale (e.g. LANG=cs_CZ.UTF-8 pnpm test) — previously fails on SubjectTypeFilter.test.tsx and Filters.test.tsx snapshots.
  • CI still passes (English locale — sort order is unchanged from before).
  • Visual check: filter checkbox order in the UI is unchanged on an English system.

🤖 Generated with Claude Code

`localeCompare()` and `toLocaleLowerCase()` use the host locale by
default, which makes the resulting filter checkbox order
machine-dependent. Under `cs_CZ.UTF-8`, for example, "Check Suite"
sorts after "Co...", "De..." entries because Czech treats "ch" as a
digraph that collates after "h", causing the `SubjectTypeFilter` and
`Filters` snapshot tests to fail for non-English contributors while
passing in CI.

Pin the comparator to `'en'` and use `toLowerCase()` so the order is
stable across machines. The filter type labels are hardcoded English
strings (no i18n in this app), so sorting them in English is
semantically correct.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@setchy setchy added the refactor Refactoring of existing feature label May 6, 2026
Copy link
Copy Markdown
Member

@setchy setchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you 🙇

@setchy setchy merged commit 6237d6e into gitify-app:main May 6, 2026
11 of 12 checks passed
@setchy setchy added this to the Release 7.0.0 milestone May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring of existing feature

Development

Successfully merging this pull request may close these issues.

2 participants