hi, this seems to be a misunderstanding on how patches work in VL compared to patches in vvvv.
in your second example the TogEdge and its state becomes part of the state of your own data type:
so in order to preserve the state of the TogEdge you need to preserve the state of an instance of your data type. either by also using an implicit instance via a process node:
or by managing an instance (hence the state) of your type on your own:
which in this concrete example does exactly the same as the process node but explicitly.
some more details if you are interested:
your data type is set to Class, so a link of that type only transports a reference from pin to pin. this means that in the above example you don’t actually need to write something back to the MyInstance property, because the Update will update the one instance stored in the property.
this can lead to bugs if you have many operations that modify (mutate) its state because the order of execution becomes important.
anyway, this works too:
if you set your data type to the recommended Record. Then the links actually transport the whole instance from pin to pin and you get a new modified instance after each operation that modifies the instance, Update in this case. This makes data flow patching much simpler because order doesn’t matter.
in that case however you need to store the new instance that comes out of Update back to the property in order to get it back in the next frame: