Core Data: Normalize _fields value for use in stableKey#27526
Conversation
|
Size Change: +9 B (0%) Total Size: 1.3 MB
ℹ️ View Unchanged
|
|
Just noticed the same in WordPress 5.6. @youknowriad Do you have any feedback on this PR? |
|
Thanks for catching this, is there a way to ensure that we use the same "functions" to encode the query in both places? |
|
@youknowriad we're much closer now, since both are using |
youknowriad
left a comment
There was a problem hiding this comment.
Thanks for the fix, looks like there's still a failing unit test that
| if ( key === '_fields' ) { | ||
| parts.fields = getNormalizedCommaSeparable( value ); | ||
| // Make sure to normalize value for `stableKey` | ||
| value = parts.fields.join(); |
There was a problem hiding this comment.
Nit: should we be using another variable to avoid changing the semantic of the original variable.
There was a problem hiding this comment.
I stuck with changing value so that we could leave the parts.stableKey builder alone - I thought it would be simpler this way. Is there enough of a drawback here to reconsider that?
ec6e2f5 to
ffe270c
Compare
* Core Data: Normalize _fields value for use in stableKey * Fix existing tests * Fix selector used in tests
These are backports coming for the 5.6.1 release. Summary of the following issues: * [#27970](WordPress/gutenberg#27970) - Fix editor crash when registering a block pattern without `categories` Backport to WP Minor Release [Feature] Inserter [Feature] Patterns [Type] Bug * [#27733](WordPress/gutenberg#27733) - [Embed block]: Add html and reusable support back Backport to WP Minor Release [Block] Embed [Type] Regression * [#27727](WordPress/gutenberg#27727) - Add aria labels to box control component inputs/button Backport to WP Minor Release [Feature] UI Components [Package] Components [Type] Bug [a11y] Labelling * [#27627](WordPress/gutenberg#27627) - HTML Block: Fix editor styles Backport to WP Minor Release [Block] HTML [Type] Regression * [#27526](WordPress/gutenberg#27526) - Core Data: Normalize `_fields` value for use in `stableKey` Backport to WP Minor Release [Package] Core data [Type] Bug * [#26705](WordPress/gutenberg#26705) - Fix: Font size picker does not correctly handles big font sizes. Backport to WP Minor Release [Type] Bug * [#26432](WordPress/gutenberg#26432) - Edit Site: prevent inserter overscroll Backport to WP Minor Release First-time Contributor [Feature] Full Site Editing [Type] Bug Packages updated: @wordpress/block-directory@1.17.7 @wordpress/block-editor@5.1.6 @wordpress/block-library@2.26.7 @wordpress/components@11.1.4 @wordpress/core-data@2.24.3 @wordpress/edit-post@3.25.7 @wordpress/edit-site@1.15.7 @wordpress/edit-widgets@1.1.7 @wordpress/editor@9.24.6 @wordpress/format-library@1.25.6 @wordpress/interface@0.10.7 @wordpress/list-reusable-blocks@1.24.4 @wordpress/nux@3.23.4 @wordpress/reusable-blocks@1.0.6 @wordpress/server-side-render@1.19.4 Fixes #52391. Props gziolo, whyisjake. git-svn-id: https://develop.svn.wordpress.org/branches/5.6@50061 602fd350-edb4-49c9-b593-d223f7449a82
These are backports coming for the 5.6.1 release. Summary of the following issues: * [#27970](WordPress/gutenberg#27970) - Fix editor crash when registering a block pattern without `categories` Backport to WP Minor Release [Feature] Inserter [Feature] Patterns [Type] Bug * [#27733](WordPress/gutenberg#27733) - [Embed block]: Add html and reusable support back Backport to WP Minor Release [Block] Embed [Type] Regression * [#27727](WordPress/gutenberg#27727) - Add aria labels to box control component inputs/button Backport to WP Minor Release [Feature] UI Components [Package] Components [Type] Bug [a11y] Labelling * [#27627](WordPress/gutenberg#27627) - HTML Block: Fix editor styles Backport to WP Minor Release [Block] HTML [Type] Regression * [#27526](WordPress/gutenberg#27526) - Core Data: Normalize `_fields` value for use in `stableKey` Backport to WP Minor Release [Package] Core data [Type] Bug * [#26705](WordPress/gutenberg#26705) - Fix: Font size picker does not correctly handles big font sizes. Backport to WP Minor Release [Type] Bug * [#26432](WordPress/gutenberg#26432) - Edit Site: prevent inserter overscroll Backport to WP Minor Release First-time Contributor [Feature] Full Site Editing [Type] Bug Packages updated: @wordpress/block-directory@1.17.7 @wordpress/block-editor@5.1.6 @wordpress/block-library@2.26.7 @wordpress/components@11.1.4 @wordpress/core-data@2.24.3 @wordpress/edit-post@3.25.7 @wordpress/edit-site@1.15.7 @wordpress/edit-widgets@1.1.7 @wordpress/editor@9.24.6 @wordpress/format-library@1.25.6 @wordpress/interface@0.10.7 @wordpress/list-reusable-blocks@1.24.4 @wordpress/nux@3.23.4 @wordpress/reusable-blocks@1.0.6 @wordpress/server-side-render@1.19.4 Fixes #52391. Props gziolo, whyisjake. Built from https://develop.svn.wordpress.org/branches/5.6@50061 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These are backports coming for the 5.6.1 release. Summary of the following issues: * [#27970](WordPress/gutenberg#27970) - Fix editor crash when registering a block pattern without `categories` Backport to WP Minor Release [Feature] Inserter [Feature] Patterns [Type] Bug * [#27733](WordPress/gutenberg#27733) - [Embed block]: Add html and reusable support back Backport to WP Minor Release [Block] Embed [Type] Regression * [#27727](WordPress/gutenberg#27727) - Add aria labels to box control component inputs/button Backport to WP Minor Release [Feature] UI Components [Package] Components [Type] Bug [a11y] Labelling * [#27627](WordPress/gutenberg#27627) - HTML Block: Fix editor styles Backport to WP Minor Release [Block] HTML [Type] Regression * [#27526](WordPress/gutenberg#27526) - Core Data: Normalize `_fields` value for use in `stableKey` Backport to WP Minor Release [Package] Core data [Type] Bug * [#26705](WordPress/gutenberg#26705) - Fix: Font size picker does not correctly handles big font sizes. Backport to WP Minor Release [Type] Bug * [#26432](WordPress/gutenberg#26432) - Edit Site: prevent inserter overscroll Backport to WP Minor Release First-time Contributor [Feature] Full Site Editing [Type] Bug Packages updated: @wordpress/block-directory@1.17.7 @wordpress/block-editor@5.1.6 @wordpress/block-library@2.26.7 @wordpress/components@11.1.4 @wordpress/core-data@2.24.3 @wordpress/edit-post@3.25.7 @wordpress/edit-site@1.15.7 @wordpress/edit-widgets@1.1.7 @wordpress/editor@9.24.6 @wordpress/format-library@1.25.6 @wordpress/interface@0.10.7 @wordpress/list-reusable-blocks@1.24.4 @wordpress/nux@3.23.4 @wordpress/reusable-blocks@1.0.6 @wordpress/server-side-render@1.19.4 Fixes #52391. Props gziolo, whyisjake. Built from https://develop.svn.wordpress.org/branches/5.6@50061 git-svn-id: https://core.svn.wordpress.org/branches/5.6@49762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
This was shipped in 5.6.1, so removing the backport label: |
These are backports coming for the 5.6.1 release. Summary of the following issues: * [#27970](WordPress/gutenberg#27970) - Fix editor crash when registering a block pattern without `categories` Backport to WP Minor Release [Feature] Inserter [Feature] Patterns [Type] Bug * [#27733](WordPress/gutenberg#27733) - [Embed block]: Add html and reusable support back Backport to WP Minor Release [Block] Embed [Type] Regression * [#27727](WordPress/gutenberg#27727) - Add aria labels to box control component inputs/button Backport to WP Minor Release [Feature] UI Components [Package] Components [Type] Bug [a11y] Labelling * [#27627](WordPress/gutenberg#27627) - HTML Block: Fix editor styles Backport to WP Minor Release [Block] HTML [Type] Regression * [#27526](WordPress/gutenberg#27526) - Core Data: Normalize `_fields` value for use in `stableKey` Backport to WP Minor Release [Package] Core data [Type] Bug * [#26705](WordPress/gutenberg#26705) - Fix: Font size picker does not correctly handles big font sizes. Backport to WP Minor Release [Type] Bug * [#26432](WordPress/gutenberg#26432) - Edit Site: prevent inserter overscroll Backport to WP Minor Release First-time Contributor [Feature] Full Site Editing [Type] Bug Packages updated: @wordpress/block-directory@1.17.7 @wordpress/block-editor@5.1.6 @wordpress/block-library@2.26.7 @wordpress/components@11.1.4 @wordpress/core-data@2.24.3 @wordpress/edit-post@3.25.7 @wordpress/edit-site@1.15.7 @wordpress/edit-widgets@1.1.7 @wordpress/editor@9.24.6 @wordpress/format-library@1.25.6 @wordpress/interface@0.10.7 @wordpress/list-reusable-blocks@1.24.4 @wordpress/nux@3.23.4 @wordpress/reusable-blocks@1.0.6 @wordpress/server-side-render@1.19.4 Fixes #52391. Props gziolo, whyisjake. Built from https://develop.svn.wordpress.org/branches/5.6@50061 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49762 1a063a9b-81f0-0310-95a4-ce76da25c4cd

Requests using
getEntityRecordswith_fieldsspecified are not returning any results. This seems to have been introduced with aa701ad (when _fields is added to stableKey), because the format used for encodingfieldshere doesn't match the format used in the resolver.In my example below, if you look at the state, the key used is
_fields=id%2Cslug%2Ctitle, whilestableKeyis_fields%5B0%5D=id&_fields%5B1%5D=slug&_fields%5B2%5D=title. This mismatch means the results are never found in the state.I'm not sure if this is the best solution - there still could be a mismatch if the entity key is left out; the selector will add that into
fields, while it won't be added ingetQueryParts.To Test
Fetch records with getEntityRecords, like this:
useSelectquery, logging result the consolenull, even after the API request completesTypes of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: