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

Remove deprecated __unstableMigrate function #24931

Closed
senadir opened this issue Aug 31, 2020 · 7 comments
Closed

Remove deprecated __unstableMigrate function #24931

senadir opened this issue Aug 31, 2020 · 7 comments
Assignees
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] Data /packages/data [Type] Code Quality Issues or PRs that relate to code quality

Comments

@senadir
Copy link
Contributor

senadir commented Aug 31, 2020

wp.data.plugins.persistence has a deprecated function __unstableMigrate that should have been removed when WP 5.4 was released.

/**
* Deprecated: Remove this function and the code in WordPress Core that calls
* it once WordPress 5.4 is released.
*/
persistencePlugin.__unstableMigrate = ( pluginOptions ) => {
const persistence = createPersistenceInterface( pluginOptions );
const state = persistence.get();
// Migrate 'insertUsage' from 'core/editor' to 'core/block-editor'
const insertUsage = get( state, [
'core/editor',
'preferences',
'insertUsage',
] );
if ( insertUsage ) {
persistence.set( 'core/block-editor', {
preferences: {
insertUsage,
},
} );
}
let editPostState = state[ 'core/edit-post' ];
// Default `fullscreenMode` to `false` if any persisted state had existed
// and the user hadn't made an explicit choice about fullscreen mode. This
// is needed since `fullscreenMode` previously did not have a default value
// and was implicitly false by its absence. It is now `true` by default, but
// this change is not intended to affect upgrades from earlier versions.
const hadPersistedState = Object.keys( state ).length > 0;
const hadFullscreenModePreference = has( state, [
'core/edit-post',
'preferences',
'features',
'fullscreenMode',
] );
if ( hadPersistedState && ! hadFullscreenModePreference ) {
editPostState = merge( {}, editPostState, {
preferences: { features: { fullscreenMode: false } },
} );
}
// Migrate 'areTipsEnabled' from 'core/nux' to 'showWelcomeGuide' in 'core/edit-post'
const areTipsEnabled = get( state, [
'core/nux',
'preferences',
'areTipsEnabled',
] );
const hasWelcomeGuide = has( state, [
'core/edit-post',
'preferences',
'features',
'welcomeGuide',
] );
if ( areTipsEnabled !== undefined && ! hasWelcomeGuide ) {
editPostState = merge( {}, editPostState, {
preferences: {
features: {
welcomeGuide: areTipsEnabled,
},
},
} );
}
if ( editPostState !== state[ 'core/edit-post' ] ) {
persistence.set( 'core/edit-post', editPostState );
}
};

@senadir senadir added Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Code Quality Issues or PRs that relate to code quality [Package] Data /packages/data labels Aug 31, 2020
@sbappan
Copy link

sbappan commented Aug 31, 2020

Hi. Can I work on this issue?

@senadir
Copy link
Contributor Author

senadir commented Aug 31, 2020

@sbappan absolutely! I assigned this to you.

@sbappan
Copy link

sbappan commented Aug 31, 2020

@sbappan absolutely! I assigned this to you.

Thank you!

@BertAnthonyRochester
Copy link

#24931 (comment)

@skorasaurus skorasaurus added the [Status] Blocked Used to indicate that a current effort isn't able to move forward label Dec 24, 2020
@skorasaurus
Copy link
Member

Per discussion in the PR, #25023 ; waiting until the plugin requires 5.6.

@skorasaurus skorasaurus removed the [Status] Blocked Used to indicate that a current effort isn't able to move forward label Sep 17, 2021
@skorasaurus
Copy link
Member

skorasaurus commented Sep 17, 2021

no longer blocked due to #34536 ; 5.7 is the minimum version now

@t-hamano
Copy link
Contributor

As this issue has been properly handled by #39795, so we closed the related PR #25023.
Therefore, we would like to close this issue as well 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] Data /packages/data [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants