-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add the WP version in which some JS APIs will be removed #37854
Conversation
Size Change: +24 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
I think this is a good way to go 👍🏻 The console is a good dev oriented messaging place and this here promotes a good practice of announcing version of expiring things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach is reasonable and makes sense 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach makes sense to me. It'll be almost ten versions of WP since these deprecations.
@youknowriad What to you think about addeing this also to to the Dev Notes section?Besides the placement, if you have better and more accurate wording, I'd apprecite the correction. Slated to be removed in 6.2 are:The APIs listed have been deprecated in WordPredd 5.3 and were forward them to the new ones already. They will be entirely removed in WordPress 6.2.
|
@bph sounds good to me 👍 |
@youknowriad I think the notes might be a little confusing... The notes make it sound like every import from With that in mind, I've updated my code imports from However, when I switch from A few examples: // works fine, no deprecation message
select('core/editor').getPermalink()
// FAILS
select('core/block-editor').getPermalink()
// works fine, no deprecation message
wp.data.select('core/editor').getCurrentPostId()
// FAILS
wp.data.select('core/block-editor').getCurrentPostId()
// works fine, no deprecation message
const currentPost = useSelect(
select => select('core/editor').getCurrentPost(),
[]
);
const { editPost } = useDispatch( 'core/editor');
// FAILS
const currentPost = useSelect(
select => select('core/block-editor').getCurrentPost(),
[]
);
const { editPost } = useDispatch( 'core/block-editor'); |
Now, as I work through these updates, I also see that import {
mediaUpload,
} from '@wordpress/editor'; also isn't throwing any deprecation error. Is it possible to be more specific as to which things are getting deprecated, if it's not everything in those packages? |
@jakeparis I see how that could be confusing. If it helps, most of the APIs related to blocks moved from the editor to the block-editor package in 5.3. A lot of the APIs related to posts remain in the editor package and are not deprecated. Some of those you can also use the core-data package for. |
Were these APIs actually removed in 6.2? I don't see any mention of them being removed in the 'Removal of deprecated APIs and Components' section of the 'Miscellaneous Editor Changes in WordPress 6.2' blog post (published 2023-03-07) or in the 'WordPress 6.2 Field Guide' blog post (published 2023-03-09) more generally. (The 'Block Editor miscellaneous Dev Notes for WordPress 6.0' blog post published 2022-05-07 does indicate they will be removed and gives instructions for replacing them.) |
Most of these were not removed because there's still a lot of plugins using them. We need to probably update the expiration date or remove it for now. |
In previous WordPress versions, we've removed JS APIs that we deprecated between WP 5.0 and 5.3 but we kept some APIs that were deemed impactful.
In this PR, I'm adding an "expiration date" for these APIs. Basically I'm saying that we will be removing these APIs in WP 6.2 to warn plugin authors.
These messages appear in the console, so they could potentially be considered not visible enough? On the alternative side, these APIs were deprecated like 3 years ago and plugins authors have had enough (and will have) time to see the messages (unless they're completely ignoring their plugin).
Any thoughts on the approach? @WordPress/gutenberg-core