-
Notifications
You must be signed in to change notification settings - Fork 4k
Refactored localeCompare in SearchQueryUtils #66990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -346,6 +346,16 @@ async function navigateToSidebarOption(index: number): Promise<void> { | |
| await waitForBatchedUpdatesWithAct(); | ||
| } | ||
|
|
||
| /** | ||
| * @private | ||
| * This is a custom collator only for testing purposes. | ||
| */ | ||
| const customCollator = new Intl.Collator('en', {usage: 'sort', sensitivity: 'variant', numeric: true, caseFirst: 'upper'}); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is duplicated, I have a couple of suggestions:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep these declaration different. As otherwise, I would have to break private assumption of the variable. And I don't want to do that as I don't trust any contributor of not mishandling the variable given I saw way too many people doing anti-patterns.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, sounds good. I agree with that argument. |
||
|
|
||
| function localeCompare(a: string, b: string): number { | ||
| return customCollator.compare(a, b); | ||
| } | ||
|
|
||
| export type {MockFetch, FormData}; | ||
| export { | ||
| assertFormDataMatchesObject, | ||
|
|
@@ -363,4 +373,5 @@ export { | |
| navigateToSidebarOption, | ||
| getOnyxData, | ||
| getNavigateToChatHintRegex, | ||
| localeCompare, | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.