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

Block Directory: useMemo on Suggestions never triggers look up in block directory #21069

Closed
StevenDufresne opened this issue Mar 23, 2020 · 0 comments
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Regression Related to a regression in the latest release

Comments

@StevenDufresne
Copy link
Contributor

StevenDufresne commented Mar 23, 2020

Describe the bug
The block editor inserter menu was recently refactored and useMemo was used to wrap the suggestion list. By doing so, it ensures that it will never return an empty list (there may be some cases where it doesn't have suggestions but the general use case has them). This is problematic because the __experimentalInserterMenuExtension.Slot expects the list to at some point be empty to show the No blocks found copy and also as the queue to search in the block directory.

Introduced in: #20880

The Memoized list

const suggestedItems = useMemo( () => {

The calculation of hasItems

The check in the menu slot


To reproduce
Steps to reproduce the behavior:

  1. Open the inserter Menu
  2. Type in a block that doesn't exist
  3. Expect to see a search loader -> No blocks found

Expected behavior
The hasItems boolean needs to come back false so we can check for plugins in the block directory.

Additional context

@StevenDufresne StevenDufresne changed the title Block Directory: useMemo on Suggestions never triggers look up in blcok directory Block Directory: useMemo on Suggestions never triggers look up in block directory Mar 23, 2020
@gziolo gziolo added [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Regression Related to a regression in the latest release labels Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

No branches or pull requests

2 participants