Stackable icon indicating copy to clipboard operation
Stackable copied to clipboard

Refactor usage of __unstableGetClientIdsTree before WordPress 6.4

Open bfintal opened this issue 1 year ago • 0 comments

__unstableGetClientIdsTree of wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree() will be removed from WordPress in 6.5, we need to remove it by 6.4

Currently, we are using __unstableGetClientIdsTree in 2 areas:

  1. Navigator panel
  2. useBlockContext hook

We will need to remove our dependency from this experimental function. I think we can do it the following way.

Navigator panel

Options:

  1. We can re-create this method because we really need to get the entire tree for the Navigator to work.
  2. We can discuss next time whether we can remove this Navigator feature because more and more people are using the Block Editor and there might not be any need for this feature now.

useBlockContext hook

We created the useBlockContext hook to increase the speed of looking up the surrounding context of a block (it's siblings, parent block, index, etc). From our performance release before, we found out that using the native methods were slower than expected.

Options:

  1. We can re-create the __unstableGetClientIdsTree method - not too sure about this because the benefit of using __unstableGetClientIdsTree is that it's already using the data in the core store - we might lose efficiency by recreating our own
  2. We can revisit the code that use useBlockContext and see whether we can refactor the use of the hook out.

bfintal avatar Aug 03 '23 04:08 bfintal