Teact: Hide memo debug in production (#6554)
This commit is contained in:
parent
ca9746bf74
commit
c891c4207b
@ -286,28 +286,30 @@ const DEBUG_components: AnyLiteral = { TOTAL: { name: 'TOTAL', renders: 0 } };
|
|||||||
const DEBUG_memos: Record<string, { key: string; calls: number; misses: number; hitRate: number }> = {};
|
const DEBUG_memos: Record<string, { key: string; calls: number; misses: number; hitRate: number }> = {};
|
||||||
const DEBUG_MEMOS_CALLS_THRESHOLD = 20;
|
const DEBUG_MEMOS_CALLS_THRESHOLD = 20;
|
||||||
|
|
||||||
document.addEventListener('dblclick', () => {
|
if (DEBUG) {
|
||||||
// eslint-disable-next-line no-console
|
document.addEventListener('dblclick', () => {
|
||||||
console.warn('COMPONENTS', orderBy(
|
// eslint-disable-next-line no-console
|
||||||
Object
|
console.warn('COMPONENTS', orderBy(
|
||||||
.values(DEBUG_components)
|
Object
|
||||||
.map(({ avgRenderTime, ...state }) => {
|
.values(DEBUG_components)
|
||||||
return { ...state, ...(avgRenderTime !== undefined && { avgRenderTime: Number(avgRenderTime.toFixed(2)) }) };
|
.map(({ avgRenderTime, ...state }) => {
|
||||||
}),
|
return { ...state, ...(avgRenderTime !== undefined && { avgRenderTime: Number(avgRenderTime.toFixed(2)) }) };
|
||||||
'renders',
|
}),
|
||||||
'desc',
|
'renders',
|
||||||
));
|
'desc',
|
||||||
|
));
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn('MEMOS', orderBy(
|
console.warn('MEMOS', orderBy(
|
||||||
Object
|
Object
|
||||||
.values(DEBUG_memos)
|
.values(DEBUG_memos)
|
||||||
.filter(({ calls }) => calls >= DEBUG_MEMOS_CALLS_THRESHOLD)
|
.filter(({ calls }) => calls >= DEBUG_MEMOS_CALLS_THRESHOLD)
|
||||||
.map((state) => ({ ...state, hitRate: Number(state.hitRate.toFixed(2)) })),
|
.map((state) => ({ ...state, hitRate: Number(state.hitRate.toFixed(2)) })),
|
||||||
'hitRate',
|
'hitRate',
|
||||||
'asc',
|
'asc',
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let instancesPendingUpdate = new Set<ComponentInstance>();
|
let instancesPendingUpdate = new Set<ComponentInstance>();
|
||||||
let idsToExcludeFromUpdate = new Set<number>();
|
let idsToExcludeFromUpdate = new Set<number>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user