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

Packages[core-data]: Change "include" type in getQueryParts #40570

Conversation

mauriac
Copy link
Member

@mauriac mauriac commented Apr 24, 2022

What?

Convert the value of the parameter include into a string when it's
a number.

Why?

fixes: #27771

This bug is backwards compatibility issue

How?

Testing Instructions

  1. Make a clean Wordpress installation
  2. Upload an image to the media library and take note of it's post_id (let's say it's 6)
  3. Open the page editor and the Javascript console then type in wp.data.select('core').getEntityRecords('postType', 'attachment', { include: 6 })
  4. wp.data.select('core').getEntityRecords('postType', 'attachment', { include: '6' })
  5. steps 3 and 4 should return the same result : the attachment data

Head's up: steps 3 or 4 could return null first, and then the second time the attachment data after the request had resolved.

Screenshots or screencast

Convert the value of the parameter include into a string when it's
a number.
@mauriac mauriac requested a review from nerrad as a code owner April 24, 2022 18:33
@mauriac mauriac requested a review from talldan April 24, 2022 18:48
@mauriac mauriac added [Package] Core data /packages/core-data [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability labels Apr 25, 2022
@talldan talldan requested a review from a team April 26, 2022 07:39
@getdave getdave requested a review from adamziel April 27, 2022 09:42
@getdave
Copy link
Contributor

getdave commented Apr 27, 2022

@adamziel might be a good person to take a look at this one if he has time alongside his duties as Editor release lead.

@adamziel adamziel added the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Apr 29, 2022
@adamziel adamziel merged commit fa23944 into WordPress:trunk Apr 29, 2022
@github-actions github-actions bot added this to the Gutenberg 13.2 milestone Apr 29, 2022
@mauriac mauriac deleted the fix/data-getEntityRecords-works-for-attachment branch April 29, 2022 13:36
adamziel pushed a commit that referenced this pull request Apr 29, 2022
… in getQueryParts (#40570)

* Packages[core-data]: Change "include" type in getQueryParts

Convert the value of the parameter include into a string when it's
a number.

* Add some units test
@adamziel
Copy link
Contributor

I cherry picked this change into wp/6.0 branch to be included in WordPress 6.0 Beta 4 on Monday: 0bfa48c

@adamziel adamziel removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Package] Core data /packages/core-data [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getEntityRecords() for 'attachment' post type no longer works with Wordpress 5.6
3 participants