Skip to content

Commit

Permalink
Interface: Fix deprecation messages (WordPress#40825)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored May 5, 2022
1 parent aad34ef commit 1a391a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/edit-post/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ function convertPanelsToOldFormat( inactivePanels, openPanels ) {
* @return {Object} Preferences Object.
*/
export const getPreferences = createRegistrySelector( ( select ) => () => {
deprecated( `wp.data.select( 'core/edit-post' ).getPreferences`, {
deprecated( `select( 'core/edit-post' ).getPreferences`, {
since: '6.0',
alternative: `wp.data.select( 'core/preferences' ).get`,
alternative: `select( 'core/preferences' ).get`,
} );

// These preferences now exist in the preferences store.
Expand Down Expand Up @@ -204,9 +204,9 @@ export const getPreferences = createRegistrySelector( ( select ) => () => {
* @return {*} Preference Value.
*/
export function getPreference( state, preferenceKey, defaultValue ) {
deprecated( `wp.data.select( 'core/edit-post' ).getPreference`, {
deprecated( `select( 'core/edit-post' ).getPreference`, {
since: '6.0',
alternative: `wp.data.select( 'core/preferences' ).get`,
alternative: `select( 'core/preferences' ).get`,
} );

// Avoid using the `getPreferences` registry selector where possible.
Expand Down
12 changes: 6 additions & 6 deletions packages/interface/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export const unpinItem = ( scope, item ) => ( { registry } ) => {
*/
export function toggleFeature( scope, featureName ) {
return function ( { registry } ) {
deprecated( `wp.dispatch( 'core/interface' ).toggleFeature`, {
deprecated( `dispatch( 'core/interface' ).toggleFeature`, {
since: '6.0',
alternative: `wp.dispatch( 'core/preferences' ).toggle`,
alternative: `dispatch( 'core/preferences' ).toggle`,
} );

registry.dispatch( preferencesStore ).toggle( scope, featureName );
Expand All @@ -112,9 +112,9 @@ export function toggleFeature( scope, featureName ) {
*/
export function setFeatureValue( scope, featureName, value ) {
return function ( { registry } ) {
deprecated( `wp.dispatch( 'core/interface' ).setFeatureValue`, {
deprecated( `dispatch( 'core/interface' ).setFeatureValue`, {
since: '6.0',
alternative: `wp.dispatch( 'core/preferences' ).set`,
alternative: `dispatch( 'core/preferences' ).set`,
} );

registry
Expand All @@ -133,9 +133,9 @@ export function setFeatureValue( scope, featureName, value ) {
*/
export function setFeatureDefaults( scope, defaults ) {
return function ( { registry } ) {
deprecated( `wp.dispatch( 'core/interface' ).setFeatureDefaults`, {
deprecated( `dispatch( 'core/interface' ).setFeatureDefaults`, {
since: '6.0',
alternative: `wp.dispatch( 'core/preferences' ).setDefaults`,
alternative: `dispatch( 'core/preferences' ).setDefaults`,
} );

registry.dispatch( preferencesStore ).setDefaults( scope, defaults );
Expand Down
4 changes: 2 additions & 2 deletions packages/interface/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export const isItemPinned = createRegistrySelector(
export const isFeatureActive = createRegistrySelector(
( select ) => ( state, scope, featureName ) => {
deprecated(
`wp.select( 'core/interface' ).isFeatureActive( scope, featureName )`,
`select( 'core/interface' ).isFeatureActive( scope, featureName )`,
{
since: '6.0',
alternative: `!! wp.select( 'core/preferences' ).isFeatureActive( scope, featureName )`,
alternative: `select( 'core/preferences' ).get( scope, featureName )`,
}
);

Expand Down

0 comments on commit 1a391a4

Please sign in to comment.