File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,15 +78,29 @@ export function doExpensiveClientSideSortingIfNeeded(
7878
7979 if ( languageForSorting === "none" ) languageForSorting = undefined ;
8080
81- const comparator = new Intl . Collator (
82- languageForSorting /* it's ok if this is missing */ ,
83- { numeric : true } // will strip off leading 0's.
84- ) ;
85- const r = books . sort (
86- ( a : IBookInfoForSorting , b : IBookInfoForSorting ) =>
87- comparator . compare ( a . sortKey ! , b . sortKey ! )
88- ) ;
89- return r ;
81+ try {
82+ const comparator = new Intl . Collator (
83+ languageForSorting /* it's ok if this is missing */ ,
84+ { numeric : true } // will strip off leading 0's.
85+ ) ;
86+ const r = books . sort (
87+ ( a : IBookInfoForSorting , b : IBookInfoForSorting ) =>
88+ comparator . compare ( a . sortKey ! , b . sortKey ! )
89+ ) ;
90+ return r ;
91+ } catch ( e ) {
92+ console . error ( `Error occurred during sorting: ${ e } ` ) ;
93+ console . error ( `languageForSorting = "${ languageForSorting } "` ) ;
94+ const comparator = new Intl . Collator (
95+ undefined /* it's ok if this is missing */ ,
96+ { numeric : true } // will strip off leading 0's.
97+ ) ;
98+ const r = books . sort (
99+ ( a : IBookInfoForSorting , b : IBookInfoForSorting ) =>
100+ comparator . compare ( a . sortKey ! , b . sortKey ! )
101+ ) ;
102+ return r ;
103+ }
90104 default :
91105 return books ; // we already ordered them on the server
92106 }
You can’t perform that action at this time.
0 commit comments