Skip to content

Conversation

JohnTheGr8
Copy link
Member

@JohnTheGr8 JohnTheGr8 commented Jun 6, 2023

This quick PR introduces the following changes:

  1. the IsReQuery property is added to the Query class, which will be set to true whenever a Query is re-executed.
  2. the Ctrl + R key binding is added for quickly re-executing the current query.

This enables Ctrl + R to act as a "refresh" mechanism. When users type a query and the shown results seem out-of-date (for example, due to caching), they can hit Ctrl + R to get fresh results.

Example use-case

The Github plugin caches all query results to avoid rate-limits (and because the Github API is pretty slow). When the user tries to list the issues for a repository, they are likely to get cached results, and therefore recently created issues may be missing. Ctrl + R can be used to signal the plugin to skip the cache and load the repository's issues from the API.

TODO: update readme + docs

When a plugin is processing a query, it can check the `IsForced` property
to decide if the results will be served from cache or not.
@JohnTheGr8 JohnTheGr8 added enhancement New feature or request kind/ux related to user experience labels Jun 6, 2023
@JohnTheGr8 JohnTheGr8 requested review from Garulf and jjw24 June 6, 2023 10:52
@JohnTheGr8 JohnTheGr8 self-assigned this Jun 6, 2023
@taooceros
Copy link
Member

Interesting, but I also remember that f5 acts like reload plugin data? Will the two feature overlap?

@JohnTheGr8
Copy link
Member Author

Interesting, but I also remember that f5 acts like reload plugin data? Will the two feature overlap?

This is not the same... as far as I understand F5 signals (all?) plugins to clear their state and start over. This change should only signal the plugins handling the current query to maybe clear any cache related to the current query.

So, in terms of my example above, F5 would cause the Github plugin to completely clear all cache, whereas Ctrl + R would only clear the cache of issues for the selected repository.

@Garulf
Copy link
Member

Garulf commented Jun 6, 2023

This is a very useful feature.

It would be nice if plugins could control how long the cache of results lasts. 🤔

@taooceros
Copy link
Member

Sounds very useful. I am only a little bit worrying whether users may get confused between these two.

@Garulf
Copy link
Member

Garulf commented Jun 6, 2023

I doubt many users even know about F5

@JohnTheGr8
Copy link
Member Author

Does F5 call ReloadData(Async) on all plugins? I don't remember how this is implemented... 🤔

If yes, is it common for a user to want to do that frequently? I understand why a user might want to trigger a ReloadData for certain plugins like BrowserBookmarks or Program, but for all plugins it seems weird...

@jjw24
Copy link
Member

jjw24 commented Jun 6, 2023

The reload data function provides an interface for plugins, when implemented they can write their own method of reloading their data. It is a call to all plugins that implemented the interface.

It is used for users that want to manually trigger a reload to update their plugin data. For example I don't think the PluginsManager has it implemented, if not I actually want to add it so we can press F5 and have the manifest manually updated.

It is async operation so from my experience all plugins finish very fast within a sec or two, I haven't had a chance to look at the code in this PR but I think instead of introducing a new hotkey, can the plugin not just use the reload interface to refresh cache?

@JohnTheGr8 JohnTheGr8 requested a review from jjw24 June 11, 2023 13:21
@JohnTheGr8 JohnTheGr8 added this to the 1.15.1 milestone Jun 11, 2023
@jjw24 jjw24 enabled auto-merge June 13, 2023 08:34
@jjw24 jjw24 merged commit 0047d8a into Flow-Launcher:dev Jun 13, 2023
@jjw24
Copy link
Member

jjw24 commented Jun 13, 2023

We need to update readme + docs, will do this separately.

@jjw24 jjw24 modified the milestones: 1.15.1, 1.16.0 Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request kind/ux related to user experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants