DevTools: Show hook names based on variable usage (#21641)

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
Co-authored-by: Saphal Patro <saphal1998@gmail.com>
Co-authored-by: VibhorCodecianGupta <vibhordelgupta@gmail.com>
This commit is contained in:
Brian Vaughn
2021-07-01 14:39:18 -04:00
committed by GitHub
co-authored by Brian Vaughn Saphal Patro VibhorCodecianGupta
parent ab390c65ee
commit c5cfa71948
84 changed files with 2966 additions and 74 deletions
+5 -1
View File
@@ -47,13 +47,17 @@ import {
} from 'react-devtools-shared/src/types';
import {localStorageGetItem, localStorageSetItem} from './storage';
import {meta} from './hydration';
import type {ComponentFilter, ElementType} from './types';
import type {LRUCache} from 'react-devtools-shared/src/types';
const cachedDisplayNames: WeakMap<Function, string> = new WeakMap();
// On large trees, encoding takes significant time.
// Try to reuse the already encoded strings.
const encodedStringCache = new LRU({max: 1000});
const encodedStringCache: LRUCache<string, Array<number>> = new LRU({
max: 1000,
});
export function alphaSortKeys(
a: string | number | Symbol,