Skip to content

Commit

Permalink
Mark createStoreDefinition as unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored and youknowriad committed Nov 17, 2020
1 parent c554ef2 commit fcd8c78
Show file tree
Hide file tree
Showing 21 changed files with 97 additions and 60 deletions.
7 changes: 5 additions & 2 deletions packages/annotations/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -22,7 +25,7 @@ const STORE_NAME = 'core/annotations';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, {
reducer,
Expand Down
7 changes: 5 additions & 2 deletions packages/block-directory/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';
import { controls as dataControls } from '@wordpress/data-controls';

/**
Expand Down Expand Up @@ -40,6 +43,6 @@ export const storeConfig = {
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, storeConfig );
7 changes: 5 additions & 2 deletions packages/block-editor/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand Down Expand Up @@ -38,7 +41,7 @@ export const storeConfig = {
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

const store = registerStore( STORE_NAME, {
...storeConfig,
Expand Down
7 changes: 5 additions & 2 deletions packages/blocks/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -19,6 +22,6 @@ const STORE_NAME = 'core/blocks';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, { reducer, selectors, actions } );
7 changes: 5 additions & 2 deletions packages/core-data/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';
import { controls } from '@wordpress/data-controls';

/**
Expand Down Expand Up @@ -70,7 +73,7 @@ export const storeConfig = {
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

registerStore( STORE_NAME, storeConfig );

Expand Down
18 changes: 0 additions & 18 deletions packages/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,24 +434,6 @@ _Returns_

- `Function`: Registry selector that can be registered with a store.

<a name="createStoreDefinition" href="#createStoreDefinition">#</a> **createStoreDefinition**

Creates a store definition to pass to store API methods.

_Usage_

```js
const storeDefinition = createStoreDefinition( 'my-shop' );
```

_Parameters_

- _storeName_ `string`: Unique namespace identifier for the store.

_Returns_

- `Object`: Store definition object.

<a name="dispatch" href="#dispatch">#</a> **dispatch**

Given the name of a registered store, returns an object of the store's action creators.
Expand Down
4 changes: 2 additions & 2 deletions packages/data/src/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ export function createRegistryControl( registryControl ) {
*
* @example
* ```js
* const storeDefinition = createStoreDefinition( 'my-shop' );
* const storeDefinition = __unstableCreateStoreDefinition( 'my-shop' );
* ```
*
* @param {string} storeName Unique namespace identifier for the store.
*
* @return {Object} Store definition object.
*/
export function createStoreDefinition( storeName ) {
export function __unstableCreateStoreDefinition( storeName ) {
return {
name: storeName,
toString() {
Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export { createRegistry } from './registry';
export {
createRegistrySelector,
createRegistryControl,
createStoreDefinition,
__unstableCreateStoreDefinition,
} from './factory';
export { controls } from './controls';

Expand Down
8 changes: 4 additions & 4 deletions packages/data/src/test/factory.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/**
* Internal dependencies
*/
import { createStoreDefinition } from '../factory';
import { __unstableCreateStoreDefinition } from '../factory';

describe( 'createStoreDefinition', () => {
describe( '__unstableCreateStoreDefinition', () => {
it( 'creates store definition', () => {
const result = createStoreDefinition( 'my-shop' );
const result = __unstableCreateStoreDefinition( 'my-shop' );

expect( result.name ).toBe( 'my-shop' );
} );

it( 'casts the definition to string', () => {
const result = createStoreDefinition( 'my-shop' );
const result = __unstableCreateStoreDefinition( 'my-shop' );

expect( String( result ) ).toBe( 'my-shop' );
} );
Expand Down
13 changes: 10 additions & 3 deletions packages/data/src/test/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { castArray, mapValues } from 'lodash';
* Internal dependencies
*/
import { createRegistry } from '../registry';
import { createRegistrySelector, createStoreDefinition } from '../factory';
import {
createRegistrySelector,
__unstableCreateStoreDefinition,
} from '../factory';

jest.useFakeTimers();

Expand Down Expand Up @@ -553,7 +556,9 @@ describe( 'createRegistry', () => {

it( 'should work with the store definition as param for select', () => {
const STORE_NAME = 'demo';
const storeDefinition = createStoreDefinition( STORE_NAME );
const storeDefinition = __unstableCreateStoreDefinition(
STORE_NAME
);
registry.registerStore( STORE_NAME, {
reducer: ( state = 'OK' ) => state,
selectors: {
Expand Down Expand Up @@ -699,7 +704,9 @@ describe( 'createRegistry', () => {

it( 'should work with the store object as param for dispatch', async () => {
const STORE_NAME = 'demo';
const storeDefinition = createStoreDefinition( STORE_NAME );
const storeDefinition = __unstableCreateStoreDefinition(
STORE_NAME
);
const store = registry.registerStore( STORE_NAME, {
reducer( state = 'OK', action ) {
if ( action.type === 'UPDATE' ) {
Expand Down
7 changes: 5 additions & 2 deletions packages/edit-navigation/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand Down Expand Up @@ -39,6 +42,6 @@ export const storeConfig = {
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, storeConfig );
7 changes: 5 additions & 2 deletions packages/edit-post/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -19,7 +22,7 @@ import { STORE_NAME } from './constants';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

const store = registerStore( STORE_NAME, {
reducer,
Expand Down
7 changes: 5 additions & 2 deletions packages/edit-widgets/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
* WordPress dependencies
*/
import apiFetch from '@wordpress/api-fetch';
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand Down Expand Up @@ -41,7 +44,7 @@ export const storeConfig = {
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

const store = registerStore( STORE_NAME, storeConfig );

Expand Down
7 changes: 5 additions & 2 deletions packages/editor/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';
import { controls as dataControls } from '@wordpress/data-controls';

/**
Expand Down Expand Up @@ -37,7 +40,7 @@ export const storeConfig = {
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, {
...storeConfig,
Expand Down
7 changes: 5 additions & 2 deletions packages/interface/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -18,7 +21,7 @@ import { STORE_NAME } from './constants';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, {
reducer,
Expand Down
7 changes: 5 additions & 2 deletions packages/keyboard-shortcuts/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -19,7 +22,7 @@ const STORE_NAME = 'core/keyboard-shortcuts';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, {
reducer,
Expand Down
7 changes: 5 additions & 2 deletions packages/notices/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -19,7 +22,7 @@ const STORE_NAME = 'core/notices';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, {
reducer,
Expand Down
7 changes: 5 additions & 2 deletions packages/nux/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -19,7 +22,7 @@ const STORE_NAME = 'core/nux';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, {
reducer,
Expand Down
7 changes: 5 additions & 2 deletions packages/reusable-blocks/src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/**
* WordPress dependencies
*/
import { createStoreDefinition, registerStore } from '@wordpress/data';
import {
__unstableCreateStoreDefinition,
registerStore,
} from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -20,7 +23,7 @@ const STORE_NAME = 'core/reusable-blocks';
*
* @type {Object}
*/
export const storeDefinition = createStoreDefinition( STORE_NAME );
export const storeDefinition = __unstableCreateStoreDefinition( STORE_NAME );

export default registerStore( STORE_NAME, {
actions,
Expand Down
Loading

0 comments on commit fcd8c78

Please sign in to comment.