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

Slow rendering of 'No Results' in modal #69184

Open
2 of 6 tasks
Rishit30G opened this issue Feb 13, 2025 · 3 comments
Open
2 of 6 tasks

Slow rendering of 'No Results' in modal #69184

Rishit30G opened this issue Feb 13, 2025 · 3 comments
Labels
[Package] Commands /packages/commands [Type] Bug An existing feature does not function as intended

Comments

@Rishit30G
Copy link
Contributor

Description

Discovered while reproducing #55899

When using Command + K to search, the modal slows down if no results are found. The “No Results Found” message reloads with every keystroke, making the experience feel sluggish.

Step-by-step reproduction instructions

  1. Open a post
  2. Press Cmd + K
  3. Type something in the search bar
  4. Notice when you reach No search result and continue typing, the search results flicker

Screenshots, screen recording, code snippet

Screen.Recording.2025-02-13.at.4.20.39.PM.mov

Environment info

  • Gutenberg: 20.2.0
  • WordPress: 6.7.2

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@Rishit30G Rishit30G added the [Type] Bug An existing feature does not function as intended label Feb 13, 2025
@Rishit30G
Copy link
Contributor Author

Rishit30G commented Feb 13, 2025

The Command.Empty automatically renders when there are no results for the search query, so based on this, removing the conditional checks seems to be a reasonable choice

Image ( Path: packages/commands/node_modules/cmdk/dist/index.d.ts ( Line 204-207 ) )

Result

Screen.Recording.2025-02-13.at.3.58.28.PM.mov

@yogeshbhutkar
Copy link
Contributor

I don't see this as a bug. The data loads after the network request succeeds, and removing those checks could cause a "no results found" message to appear on slow networks, even when results are available.

Ref.

no-results-test.mov

@Rishit30G
Copy link
Contributor Author

The data loads after the network request succeeds, and removing those checks could cause a "no results found" message to appear on slow networks, even when results are available.

Very well pointed out with the slow network request thing 💯
Actually I was trying to optimise the isLoading earlier, but looks like there needs to be more work done for that!
Removing the conditions was an immediate thought, felt like it optimised the behaviour ( as mentioned in the docblock )
It's not a bug, rightly said, but I feel the sluggish behaviour can be improved if we optimise maybe

@t-hamano t-hamano added the [Package] Commands /packages/commands label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Commands /packages/commands [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants