diff --git a/packages/data/CHANGELOG.md b/packages/data/CHANGELOG.md index 91362f4e1d5c4c..776d03a12ad48b 100644 --- a/packages/data/CHANGELOG.md +++ b/packages/data/CHANGELOG.md @@ -2,8 +2,11 @@ ### Bug Fix -- Restore functionality of action-generators returning a Promise. Clarify intent and behaviour for `wp.data.dispatch` behaviour. Dispatch actions now always - return a promise ([#14830](https://github.com/WordPress/gutenberg/pull/14830) +- Restore functionality of action-generators returning a Promise. Clarify intent and behaviour for `wp.data.dispatch` behaviour. Dispatch actions now always return a promise ([#14830](https://github.com/WordPress/gutenberg/pull/14830)) + +### Enhancements + +- Export the entire registry context (as `RegistryContext`) so consuming code can implement it using the `useContext` react hook ([#15445](https://github.com/WordPress/gutenberg/pull/15445)) ## 4.3.0 (2019-03-06) diff --git a/packages/data/README.md b/packages/data/README.md index 65b525d404099d..d1b6dcf2147905 100644 --- a/packages/data/README.md +++ b/packages/data/README.md @@ -381,6 +381,10 @@ _Returns_ Undocumented declaration. +# **RegistryContext** + +Undocumented declaration. + # **RegistryProvider** Undocumented declaration. diff --git a/packages/data/src/components/registry-provider/index.js b/packages/data/src/components/registry-provider/index.js index c296f46a1ab1a8..7e7bd69f27726d 100644 --- a/packages/data/src/components/registry-provider/index.js +++ b/packages/data/src/components/registry-provider/index.js @@ -8,7 +8,9 @@ import { createContext } from '@wordpress/element'; */ import defaultRegistry from '../../default-registry'; -const { Consumer, Provider } = createContext( defaultRegistry ); +export const RegistryContext = createContext( defaultRegistry ); + +const { Consumer, Provider } = RegistryContext; export const RegistryConsumer = Consumer; diff --git a/packages/data/src/index.js b/packages/data/src/index.js index c6b941d2cec954..d6eb6e263eed71 100644 --- a/packages/data/src/index.js +++ b/packages/data/src/index.js @@ -12,7 +12,11 @@ import * as plugins from './plugins'; export { default as withSelect } from './components/with-select'; export { default as withDispatch } from './components/with-dispatch'; export { default as withRegistry } from './components/with-registry'; -export { default as RegistryProvider, RegistryConsumer } from './components/registry-provider'; +export { + default as RegistryProvider, + RegistryConsumer, + RegistryContext, +} from './components/registry-provider'; export { default as __experimentalAsyncModeProvider } from './components/async-mode-provider'; export { createRegistry } from './registry'; export { plugins };