WordPress/wp-includes/block-supports
Bernhard Reiter 2e0baf4f79 Blocks: Fix layout support to be compatible with enhanced pagination.
Make layout support compatible with enhanced pagination by ensuring that generated class names are stable across pagination, even when the number of rendered posts is different.

With the previous implementation of enhanced pagination, the CSS corresponding to each block was not detected. Therefore, for enhanced pagination to work correctly, the CSS of the blocks present in the Post Template must be stable on all pages.

The number of posts rendered by the Query block is always the same, except in the last page, where it can be only a fraction. If any of the blocks rendered by the Post Template used the `wp_unique_id` function, the ID (which is incremental) would have been different than in the previous pages and the class names would have varied.

This is remediated by this changeset by replacing the usage of `wp_unique_id` in the layout support (which is used by the Query block) with an implementation that uses IDs that are incremental only for that block. That way, the generated class names are never affected by the number of times `wp_unique_id` runs.

Props luisherranz, andrewserong, isabel_brison, costdev, mukesh27, cbravobernal, hellofromTonya, jorbin.
Fixes #59681.
Built from https://develop.svn.wordpress.org/trunk@56994


git-svn-id: http://core.svn.wordpress.org/trunk@56505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-24 08:51:24 +00:00
..
align.php Editor: Simplify usage of `block_has_support()` function by supporting a string. 2023-08-10 16:48:19 +00:00
background.php Editor: fix undefined array key warning. 2023-09-27 05:12:22 +00:00
border.php Editor: Replace property_exists calls in block related functions with instanceof 2023-09-29 10:20:30 +00:00
colors.php Editor: Replace property_exists calls in block related functions with instanceof 2023-09-29 10:20:30 +00:00
custom-classname.php Editor: Simplify usage of `block_has_support()` function by supporting a string. 2023-08-10 16:48:19 +00:00
dimensions.php Coding Standards: Remove redundant ignore annotations, take 5. 2023-10-02 11:27:24 +00:00
duotone.php Editor: Lazily load Duotone settings only when needed. 2023-07-13 11:34:28 +00:00
elements.php Editor: Add further test coverage for `wp_render_elements_support()`. 2023-10-11 15:15:30 +00:00
generated-classname.php Editor: Simplify usage of `block_has_support()` function by supporting a string. 2023-08-10 16:48:19 +00:00
layout.php Blocks: Fix layout support to be compatible with enhanced pagination. 2023-10-24 08:51:24 +00:00
position.php Editor: Reduce the use of the `_wp_array_get()` function to improve performance. 2023-09-26 13:47:20 +00:00
settings.php Editor: Reduce the use of the `_wp_array_get()` function to improve performance. 2023-09-26 13:47:20 +00:00
shadow.php Editor: Simplify usage of `block_has_support()` function by supporting a string. 2023-08-10 16:48:19 +00:00
spacing.php Editor: Reduce the use of the `_wp_array_get()` function to improve performance. 2023-09-26 13:47:20 +00:00
typography.php Editor: Replace property_exists calls in block related functions with instanceof 2023-09-29 10:20:30 +00:00
utils.php Docs: Miscellaneous docblock corrections and improvements. 2023-08-18 17:29:20 +00:00