Skip to content

Commit

Permalink
Mark some data API as unstable (#40028)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Apr 4, 2022
1 parent c0c10ef commit a1d12f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/data/src/components/use-select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down Expand Up @@ -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 () => {
Expand Down
20 changes: 10 additions & 10 deletions packages/data/src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}

Expand All @@ -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();
Expand Down Expand Up @@ -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 );
}
Expand All @@ -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 ) {
Expand All @@ -281,8 +281,8 @@ export function createRegistry( storeConfigs = {}, parent = null ) {
register,
registerGenericStore,
registerStore,
__experimentalMarkListeningStores,
__experimentalSubscribeStore,
__unstableMarkListeningStores,
__unstableSubscribeStore,
};

//
Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/test/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down

0 comments on commit a1d12f2

Please sign in to comment.