Cache handling to avoid unwanted queries from running

I need to use some queries as ways of retrieving data in real time, while being able to shut them down by the click of a button. Even though, the queries won't stop running when requested.

The only way I could see the queries stoping was by manually clearing the cache and reloading the page (ctrl + shif + R). If I try using any of the provided (and already implemented) cleaning cache methods, it does not work at all.

I have tried using the event handler invalidateCache(), the dispose() method to stop the webSocket, reseting the baseQuery and now I have run out of options.

When using the event handler inside the module to clear cache and then this same event handler is triggered on the app itself, I'm getting the following error:

Unable to retrieve information about the query "queryName::input2".

The other possible solution was using the invalidateCache() method inside both the app and the module and it works fine for the module, but I still get the same error as above on the app.

I have run out of options to solve this issue, as I don't want unecessary querys to be running on the background and compromise the app's performance.

  • Screenshots:

Thanks in advance!