Skip to content

Commit e5bb32e

Browse files
committed
Remove getContextDisplayName
1 parent 637a0e0 commit e5bb32e

File tree

1 file changed

+2
-17
lines changed
  • packages/scan/src/web/components/inspector/overlay

1 file changed

+2
-17
lines changed

packages/scan/src/web/components/inspector/overlay/utils.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FunctionComponentTag } from 'bippy';
2-
import { type ComponentState } from 'react';
2+
import { Context, type ComponentState } from 'react';
33
import { type Fiber } from 'react-reconciler';
44
import { isEqual } from '~core/utils';
55

@@ -402,28 +402,13 @@ export const getCurrentContext = (fiber: Fiber) => {
402402
return contextObj;
403403
};
404404

405-
const getContextDisplayName = (contextType: unknown): string => {
406-
if (typeof contextType !== 'object' || contextType === null) {
407-
return String(contextType);
408-
}
409-
410-
return (
411-
(contextType as any)?.displayName ??
412-
(contextType as any)?.Provider?.displayName ??
413-
(contextType as any)?.Consumer?.displayName ??
414-
(contextType as any)?.type?.name?.replace('Provider', '') ??
415-
'Unnamed'
416-
);
417-
};
418-
419405
export const getChangedContext = (fiber: Fiber): Set<string> => {
420406
const changes = new Set<string>();
421407
if (!fiber.alternate) return changes;
422408

423409
const currentContexts = getAllFiberContexts(fiber);
424410

425-
for (const [contextType] of currentContexts) {
426-
const contextName = getContextDisplayName(contextType);
411+
for (const [contextName] of currentContexts) {
427412

428413
let searchFiber: Fiber | null = fiber;
429414
let providerFiber: Fiber | null = null;

0 commit comments

Comments
 (0)