luckman212 Posted May 6 Share Posted May 6 I've got a workflow that I'm trying to wrap up to be publicly released, but one question I can't figure out is: I am using a script filter that fetches results from an API which can be slow. So I use the Alfred filters results option so the script is not re-run on every keypress. This works perfectly, except if the user types a search term, then later backspaces all the way back to the beginning. At that point, instead of just displaying the original JSON results, it re-runs the script. To work around this, I set a timeout (2 minutes by default) and just cache the entire JSON. If this cache is found and fresh, it just runs cat $my_json_file instead of executing the script. That feels like a hack and I'd rather avoid it. Is there any way to tell Alfred or configure the ScriptFilter so it does NOT re-run upon backspacing to the beginning of the input box? Link to comment
Andrew Posted May 6 Share Posted May 6 @luckman212 Have you looked at the built-in JSON caching which is new in 5.5: https://www.alfredapp.com/help/workflows/inputs/script-filter/json/#cache Link to comment
luckman212 Posted May 6 Author Share Posted May 6 @Andrew Yes I did see that and I played around a bit, but of course can't remember (now) why I chose my own method instead. It could very well be that the native caching would work fine and I will try it again for sure. Back to the original question though- any reason that the script re-executes when backing the cursor up to position 0 in Alfred's entry field? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now