Add method to stop a query from running

hi, simple and easy question: can I stop a running query from fetching?
I wish I had a query.stop() function. I have a very long running query, and want to give the user permission to interrupt it midway.

1 Like

+1 this would be handy.

@Nicolo_Paternoster I'm not sure if you can still edit your post so I flagged it asking if a moderator would change the topic to Feature Requests since this isn't possible from what I've tried. If this one doesn't get it's topic changed I'd suggest making a new one using the feature request category, but before making a somewhat duplicate post let's see if we can just have this one moved

2 Likes

Thanks, I'll stay put and follow. For now I had to fake it by sort of "unbinding" the state of the UI from the status of the query.isFetching manually.

suboptimal

:up:

Thanks for this feature request! I don't believe this is on our immediate roadmap, but we are tracking requests for this feature. I'll post here if I get any updates internally about adding a way to programmatically stop a running query

oh woh, thats interesting. never thought of trying.... honestly, actually never even considered the possibility. would you mind sharing a bit of how the flow of things works or how its set up? I've considered trying a few nifty tricks like the ones suggested here or here (Promise.race, generators, event emitters). Custom cancellation token implementations basically. I just haven't had the need and time to try them out. it makes the C coder in me go nuts, but my queries haven't created enough overhead to slowdown things enough to where I, more or less, regret life decisions lol but if you have a more 'Retool-ish' solution without adding that big ol code complexity involved w any of those linked suggestions I'd happily forget anything I read from those links =)

2 Likes

This would be very useful to me as well. I have a query which fetches 10s of thousands of datapoints when the user selects a point on a scatter plot. If the user selects another point quickly, the former results are now irrelevant. Given that I can't cancel the query, the ui renders the first response and then immediately replaces it with the second response. It's a jarring user experience.

for me it starts to become a blockr, as I need to launch (and possibly a board) a 2-minutes long build process ... :frowning:

i think something like that might be better in a custom compoment where runtime length of js isnt an issue (outside of a queries runtime rtriggered from in parent app). you might beable to even spin up a worker thread to do it in the background to truly offload it from the main thread