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

Launchpad Search: Searches only when nothing is found #3770

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sergeibbb
Copy link
Member

@sergeibbb sergeibbb commented Nov 18, 2024

(#3763)

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

sergeibbb pushed a commit that referenced this pull request Nov 18, 2024
@sergeibbb sergeibbb force-pushed the 3763-launchpad-search-search-only-when-nothing-is-found branch from d30067e to ba24f42 Compare November 18, 2024 13:02
@sergeibbb sergeibbb self-assigned this Nov 18, 2024
@sergeibbb sergeibbb linked an issue Nov 18, 2024 that may be closed by this pull request
@sergeibbb sergeibbb changed the title Searches only when nothing is found Launchpad Search: Searches only when nothing is found Nov 18, 2024
Comment on lines +617 to +625
// wait a little bit because the active quickpick is updated with some delay
await new Promise(resolve => setTimeout(resolve, 100));
const hasActiveLaunchpadItems = quickpick.activeItems.find(i => 'item' in i);
if (hasActiveLaunchpadItems) {
// We have an active item, so we can exit now without sending any requests to API
this.updateItemsDebouncer.cancel();
return true;
}

Copy link
Contributor

@sergiolms sergiolms Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be handled by the onDidChangeActive event? That way we wouldn't need to create a fake Promise to await

onDidChangeActive: async quickpick => {
	// Not sure if this needs an await
	const hasActiveLaunchpadItems = await quickpick.activeItems.find(i => 'item' in i);
	if (hasActiveLaunchpadItems) {
		this.updateItemsDebouncer.cancel();
		return true;
	}
},

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sergiolms
There are following problems:

  1. I'm not sure that it's guaranteed that onDidChangeActive is called after than onDidChangeValue.
  2. If after typing, then onDidChangeValue won't probably be called at all.
  3. It just never gets executed:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at the code suggestion here #3770 (comment) and test if it works for you too. This is working for me:

Grabacion.de.pantalla.2024-11-19.a.las.15.44.09.mov

@sergeibbb sergeibbb force-pushed the 3763-launchpad-search-search-only-when-nothing-is-found branch from ba24f42 to bc466d0 Compare November 19, 2024 11:58
@sergiolms
Copy link
Contributor

Hey @sergeibbb, while reviewing your PR, I'd suggest the following code changes:

👉 Code Suggestion for #3770

#3770

You can also review and apply these suggestions locally on your machine.

Learn more about GitKraken Code Suggest

Code Suggest liberates your code reviews from GitHub's restrictive, comment-only feedback style. As simple as suggesting changes in a Google-doc, provide real code suggestions from where you code, e.g. your IDE, and on anything in your project — not just on the lines of code changed in the PR.

Join your team on GitKraken to speed up PR review.

@sergeibbb sergeibbb removed the request for review from axosoft-ramint November 19, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Launchpad Search: search only when nothing is found
3 participants