diff --git a/packages/data/src/components/use-select/index.js b/packages/data/src/components/use-select/index.js index 12f1573ffc090..cc204f19ef47b 100644 --- a/packages/data/src/components/use-select/index.js +++ b/packages/data/src/components/use-select/index.js @@ -129,7 +129,7 @@ export default function useSelect( mapSelect, deps ) { const listeningStores = useRef( [] ); const wrapSelect = useCallback( ( callback ) => - registry.__experimentalMarkListeningStores( + registry.__unstableMarkListeningStores( () => callback( registry.select, registry ), listeningStores ), @@ -222,7 +222,7 @@ export default function useSelect( mapSelect, deps ) { onChange(); const unsubscribers = listeningStores.current.map( ( storeName ) => - registry.__experimentalSubscribeStore( storeName, onChange ) + registry.__unstableSubscribeStore( storeName, onChange ) ); return () => { diff --git a/packages/data/src/registry.js b/packages/data/src/registry.js index f31cc1953828b..32150fbbc5d45 100644 --- a/packages/data/src/registry.js +++ b/packages/data/src/registry.js @@ -55,7 +55,7 @@ import { createEmitter } from './utils/emitter'; export function createRegistry( storeConfigs = {}, parent = null ) { const stores = {}; const emitter = createEmitter(); - const __experimentalListeningStores = new Set(); + const listeningStores = new Set(); /** * Global listener called for each store's update. @@ -87,7 +87,7 @@ export function createRegistry( storeConfigs = {}, parent = null ) { const storeName = isObject( storeNameOrDescriptor ) ? storeNameOrDescriptor.name : storeNameOrDescriptor; - __experimentalListeningStores.add( storeName ); + listeningStores.add( storeName ); const store = stores[ storeName ]; if ( store ) { return store.getSelectors(); @@ -96,10 +96,10 @@ export function createRegistry( storeConfigs = {}, parent = null ) { return parent && parent.select( storeName ); } - function __experimentalMarkListeningStores( callback, ref ) { - __experimentalListeningStores.clear(); + function __unstableMarkListeningStores( callback, ref ) { + listeningStores.clear(); const result = callback.call( this ); - ref.current = Array.from( __experimentalListeningStores ); + ref.current = Array.from( listeningStores ); return result; } @@ -118,7 +118,7 @@ export function createRegistry( storeConfigs = {}, parent = null ) { const storeName = isObject( storeNameOrDescriptor ) ? storeNameOrDescriptor.name : storeNameOrDescriptor; - __experimentalListeningStores.add( storeName ); + listeningStores.add( storeName ); const store = stores[ storeName ]; if ( store ) { return store.getResolveSelectors(); @@ -245,7 +245,7 @@ export function createRegistry( storeConfigs = {}, parent = null ) { * @param {Function} handler The function subscribed to the store. * @return {Function} A function to unsubscribe the handler. */ - function __experimentalSubscribeStore( storeName, handler ) { + function __unstableSubscribeStore( storeName, handler ) { if ( storeName in stores ) { return stores[ storeName ].subscribe( handler ); } @@ -258,7 +258,7 @@ export function createRegistry( storeConfigs = {}, parent = null ) { return subscribe( handler ); } - return parent.__experimentalSubscribeStore( storeName, handler ); + return parent.__unstableSubscribeStore( storeName, handler ); } function batch( callback ) { @@ -281,8 +281,8 @@ export function createRegistry( storeConfigs = {}, parent = null ) { register, registerGenericStore, registerStore, - __experimentalMarkListeningStores, - __experimentalSubscribeStore, + __unstableMarkListeningStores, + __unstableSubscribeStore, }; // diff --git a/packages/data/src/test/registry.js b/packages/data/src/test/registry.js index a1d06f0782c6e..a999dc0d02938 100644 --- a/packages/data/src/test/registry.js +++ b/packages/data/src/test/registry.js @@ -718,7 +718,7 @@ describe( 'createRegistry', () => { const listener2 = jest.fn(); // useSelect subscribes to the stores differently, // This test ensures batching works in this case as well. - const unsubscribe = registry.__experimentalSubscribeStore( + const unsubscribe = registry.__unstableSubscribeStore( 'myAwesomeReducer', listener2 );