Is there a way to nest modules within modules recursively/cyclicly? I'm looking to create an org chart visualization using a recursive module, but can’t figure out how to achieve that.
Could you help me out a bit to understand what you’re expecting and what you’ve tried? I’m just not too sure what you mean by nesting “recursively/cyclicly”, is your module importing itself? or is it just like a dynamically generated JSON object with nested objects of unknown depth?
Thanks for your help @bobthebear. I think I’ve determined that this is not possible. I was originally intending to create a tree structure by creating a module (let’s call it a “node”), that contains a list view where each element is itself a node. I ran into a couple of difficulties with this:
- Modules cannot be placed in list views
- I can work around this by creating e.g. 10 separate instances of the children nodes and showing and hiding as needed, since I know there would never be more than 10 children in a given node
- I cannot reference a module within itself. The module does not show up within the list of components to add
- I tried publishing the module, but that didn’t seem to change anything
Not to be deterred, I tried to workaround the second limitation above by creating two separate modules, let’s call them “node” and “node children”. My plan was to place the “node children” module within the “node” module, and then put multiple “node” modules within the “node children” module. Unfortunately when I tried this I got a clear error message from Retool that said that cyclic module references are not allowed. Given that, I believe this is not possible by design. I’m resorting to creating a custom component, instead.