Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the data controls after all usages were updated #26509

Merged
merged 1 commit into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/data-controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"react-native": "src/index",
"dependencies": {
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/data": "file:../data"
"@wordpress/data": "file:../data",
"@wordpress/deprecated": "file:../deprecated"
},
"publishConfig": {
"access": "public"
Expand Down
21 changes: 10 additions & 11 deletions packages/data-controls/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
*/
import triggerFetch from '@wordpress/api-fetch';
import { controls as dataControls } from '@wordpress/data';
// TODO: mark the deprecated controls after all Gutenberg usages are removed
// import deprecated from '@wordpress/deprecated';
import deprecated from '@wordpress/deprecated';

/**
* Dispatches a control action for triggering an api fetch call.
Expand Down Expand Up @@ -39,9 +38,9 @@ export function apiFetch( request ) {
* @param {Array} args Arguments passed without change to the `@wordpress/data` control.
*/
export function select( ...args ) {
// deprecated( '`select` control in `@wordpress/data-controls`', {
// alternative: 'built-in `resolveSelect` control in `@wordpress/data`',
// } );
deprecated( '`select` control in `@wordpress/data-controls`', {
alternative: 'built-in `resolveSelect` control in `@wordpress/data`',
} );

return dataControls.resolveSelect( ...args );
}
Expand All @@ -53,9 +52,9 @@ export function select( ...args ) {
* @param {Array} args Arguments passed without change to the `@wordpress/data` control.
*/
export function syncSelect( ...args ) {
// deprecated( '`syncSelect` control in `@wordpress/data-controls`', {
// alternative: 'built-in `select` control in `@wordpress/data`',
// } );
deprecated( '`syncSelect` control in `@wordpress/data-controls`', {
alternative: 'built-in `select` control in `@wordpress/data`',
} );

return dataControls.select( ...args );
}
Expand All @@ -67,9 +66,9 @@ export function syncSelect( ...args ) {
* @param {Array} args Arguments passed without change to the `@wordpress/data` control.
*/
export function dispatch( ...args ) {
// deprecated( '`dispatch` control in `@wordpress/data-controls`', {
// alternative: 'built-in `dispatch` control in `@wordpress/data`',
// } );
deprecated( '`dispatch` control in `@wordpress/data-controls`', {
alternative: 'built-in `dispatch` control in `@wordpress/data`',
} );

return dataControls.dispatch( ...args );
}
Expand Down