Ability to pass around components as arguments to `additionalScope` and in temporary state variables

I am building a fairly simple flow where the user:

clicks a button --> triggers a modal --> clicks Yes/No in that modal --> has some changes applied to their app

However, the code is significantly more convoluted because of the inability to pass components as temporary state variables or additionalScope arguments in Retool.

To compensate, I have resorted to passing a string argument, which then uses if-else logic to specify all the relevant components that need to be read and updated, in essentially what is a makeshift “reference table”. What’s worse, this if-else needs to be duplicated in every subsequent query in the logic (e.g. the query that opens the modal vs the query that applies changes after use hits “Yes” button), because queries then can’t pass these components to the next triggered query either.

I know this is a little hard to understand without looking at my code, but the crux of it is that being able to pass around components as state variables and arguments would make scripting Retool much, much more powerful and maintainable for all kinds of plausible applications such as mine.

It looks like this is running into an error with posting the whole component object. You’re right that the specific code would help with understanding the situation, but let me know if any of these help here:

  • I was able to do tempState.setValue(table1) successfully, where do you run into the issue on temp states?
  • For passing as additionalScope, you can do additionalScope: {component: JSON.stringify(table1)} as a value there, and then JSON.parse(component) inside of the target query. Does that work for you?

For #1, let me reproduce this again @alex-w, will get back to you ASAP. For #2, will try that out, have not attempted yet.