Skip to content

Commit 651bade

Browse files
im3dabasiaim3dabasialuisherranzMamadukadesrosj
authored
Display names for Context providers (#71208)
* feat: Add Context displaynames in React dev tools for improved dev exp * fix: Remove the context in interactivity hooks.tsx * chore: Add changelog entries Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org> Co-authored-by: luisherranz <luisherranz@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: desrosj <desrosj@git.wordpress.org>
1 parent 0becbde commit 651bade

File tree

55 files changed

+84
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+84
-1
lines changed

packages/block-editor/src/components/block-context/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { createContext, useContext, useMemo } from '@wordpress/element';
1515

1616
/** @type {import('react').Context<Record<string,*>>} */
1717
const Context = createContext( {} );
18+
Context.displayName = 'BlockContext';
1819

1920
/**
2021
* Component which merges passed value with current consumed block context.

packages/block-editor/src/components/block-edit/context.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export const DEFAULT_BLOCK_EDIT_CONTEXT = {
1515
};
1616

1717
const Context = createContext( DEFAULT_BLOCK_EDIT_CONTEXT );
18+
Context.displayName = 'BlockEditContext';
19+
1820
const { Provider } = Context;
1921

2022
export { Provider as BlockEditContextProvider };

packages/block-editor/src/components/block-list/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import { ZoomOutSeparator } from './zoom-out-separator';
4040
import { unlock } from '../../lock-unlock';
4141

4242
export const IntersectionObserver = createContext();
43+
IntersectionObserver.displayName = 'IntersectionObserverContext';
44+
4345
const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();
4446

4547
function Root( { className, ...settings } ) {

packages/block-editor/src/components/block-list/layout.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useSettings } from '../use-settings';
1212
export const defaultLayout = { type: 'default' };
1313

1414
const Layout = createContext( defaultLayout );
15+
Layout.displayName = 'BlockLayoutContext';
1516

1617
/**
1718
* Allows to define the layout.

packages/block-editor/src/components/block-list/private-block-context.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
import { createContext } from '@wordpress/element';
55

66
export const PrivateBlockContext = createContext( {} );
7+
PrivateBlockContext.displayName = 'PrivateBlockContext';

packages/block-editor/src/components/block-popover/inbetween.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import usePopoverScroll from './use-popover-scroll';
2626
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
2727

2828
export const InsertionPointOpenRef = createContext();
29+
InsertionPointOpenRef.displayName = 'InsertionPointOpenRefContext';
2930

3031
function BlockPopoverInbetween( {
3132
previousClientId,

packages/block-editor/src/components/block-toolbar/block-name-context.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
import { createContext } from '@wordpress/element';
55

66
const __unstableBlockNameContext = createContext( '' );
7+
__unstableBlockNameContext.displayName = '__unstableBlockNameContext';
78

89
export default __unstableBlockNameContext;

packages/block-editor/src/components/block-tools/insertion-point.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import BlockDropZonePopover from '../block-popover/drop-zone';
2121
import { unlock } from '../../lock-unlock';
2222

2323
export const InsertionPointOpenRef = createContext();
24+
InsertionPointOpenRef.displayName = 'InsertionPointOpenRefContext';
2425

2526
function InbetweenInsertionPointPopover( {
2627
__unstablePopoverSlot,

packages/block-editor/src/components/global-styles/context.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export const DEFAULT_GLOBAL_STYLES_CONTEXT = {
1313
export const GlobalStylesContext = createContext(
1414
DEFAULT_GLOBAL_STYLES_CONTEXT
1515
);
16+
GlobalStylesContext.displayName = 'GlobalStylesContext';

packages/block-editor/src/components/image-editor/context.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import useSaveImage from './use-save-image';
1010
import useTransformImage from './use-transform-image';
1111

1212
const ImageEditingContext = createContext( {} );
13+
ImageEditingContext.displayName = 'ImageEditingContext';
1314

1415
export const useImageEditingContext = () => useContext( ImageEditingContext );
1516

0 commit comments

Comments
 (0)