Is there a way for a module inside a modal to detect if it is being displayed?

I have a module in a module in a modal (say that three times fast!).

The deepest module has some queries that run reactively to changes in the app or the shallower module. I DO NOT want that to happen unless that module is active and being used.

I am stumped as to how to do this effectively. One of the best ways I can think to do this is to check is the module is visible and only run the queries then, but that does not appear to be possible within Retool.

Maybe I can set a flag in local storage if the modal with the module is opened and only run the queries if set? That's my best idea.

Any other way to do it?

module in a module in a modal module in a module in a modal module in a module in a modal

I still haven't been able to crack this, but let me ask the app building team directly :slight_smile:

Hey Brad :slight_smile: I'm back.

Modals have an opened field, so maybe you could take that as an input to innermost module1 (input named module2Enabled or something) and pass it through to outer module2 (input named enabled or something)?

Local storage would probably work as well, but could get weird if the app is open in more than one tab!

Using opened worked!

:tada::smile::raised_hands: