File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/react-devtools-shared/src Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ import {
4444 ElementTypeMemo ,
4545} from 'react-devtools-shared/src/types' ;
4646import { localStorageGetItem , localStorageSetItem } from './storage' ;
47- import { alphaSortEntries } from './devtools/views/utils' ;
4847import { meta } from './hydration' ;
4948
5049import type { ComponentFilter , ElementType } from './types' ;
@@ -55,6 +54,16 @@ const cachedDisplayNames: WeakMap<Function, string> = new WeakMap();
5554// Try to reuse the already encoded strings.
5655let encodedStringCache = new LRU ( { max : 1000 } ) ;
5756
57+ export function alphaSortKeys ( a : string , b : string ) : number {
58+ if ( a > b ) {
59+ return 1 ;
60+ } else if ( b > a ) {
61+ return - 1 ;
62+ } else {
63+ return 0 ;
64+ }
65+ }
66+
5867export function getDisplayName (
5968 type : Function ,
6069 fallbackName : string = 'Anonymous' ,
@@ -601,7 +610,7 @@ export function formatDataForPreview(
601610 return data . toString ( ) ;
602611 case 'object' :
603612 if ( showFormattedValue ) {
604- const keys = Object . keys ( data ) . sort ( alphaSortEntries ) ;
613+ const keys = Object . keys ( data ) . sort ( alphaSortKeys ) ;
605614
606615 let formatted = '' ;
607616 for ( let i = 0 ; i < keys . length ; i ++ ) {
You can’t perform that action at this time.
0 commit comments