search: Hide/cancel suggestions after query is submitted (CodeMirror)
Created by: fkling
Fixes #38289 (closed)
It's currently possible for the suggestions popover to appear after the query was submitted. It also stays open when the query is submitted which doesn't feel right either.
This commit:
- Hides/cancels suggestions when the onSubmit callback is provided and called
- Hides/cancels suggestions when the editor looses focus
Note that callsites who use CodeMirrorQueryInput
directly (e.g.
Notebooks) still suffer from that problem. But since they provide
completion sources themselves they also have to handle that case
themselves (at least for the time being).
Before/after video (you can't see when I press enter but you can see that the suggestions appear after the search results load):
https://user-images.githubusercontent.com/179026/177772409-a2496107-9f85-4399-99ec-55adb7347c5d.mp4
Test plan
Enter search term and press enter immediately. No suggestions should be shown. Repeat this a couple of times to increase confidence because the server does not always return suggestions.
App preview:
Check out the client app preview documentation to learn more.