ValueTreeRedirected setStateInformation get state information

So I had this issue where I would lose my valuetree listeners for more complex value trees other than parameters example : value object lists In set state Information calls

Figured out a solution in case anyone has the same problem

AVPTS has an inner value tree

Usually accessed like avpts.state

In your gui component wrapper

Add a listener

avpts.state.addListener

And do the appropriate clean up functions in your destructor of course

After adding ValueTreeListener to you wrapping component above

Every time set state information gets called

valueTreeRedirected will be called

apply the appropriate state update by destroying the previous child gui component and reinitialize with this child component object with the new state from valueTreeRedirected callback

Adding the child component again and setting it visible

Make sure to do the appropriate cleanups in your functions

You can break this up for all complex states in multiple components because ValueTreeRedirected will always be called just grab the state pertaining to you valuetree node of choice for that component