I’ve been working on a project for a client where we have compiled using the Script Editor a range of there GH scripts into GH components for use across a range of there applications.
I’ve been given feed back from the client that the GH components created from this process “forget” their preview status when saved and re-opened.
I’ve manage to replicate the problem with a simple version:
Attached is a zip file with the project used in the above video.
The work around is to turn off the preview on ALL of the components code, however you then lose any preview when the component is in use.
I often use MetaHopper with one toggle to enable/disable and preview on/off my component preview settings. That way if a certain object preview gets changed, I have the toggle to fall back on.
Thanks @koramblyum - that is a possible option, however I’m still interested in @eirannejad to take a look an see if we can solve the underlying issue as well.
I don’t know about this particular cause of this problem, but you should be able to subscribe to various events and either dump the states in static memory (e.g. global dictionary) or even in a file, to set the preview state in second step. It’s not ideal, but would be a workaround until this behavior is fixed (if the bug is not on your side). E.g. there is a “SolutionStart” event on the GH document. Using events/observer is a bit error prone. Especially when using Python. You should also take care about unsubscribing and debouncing. Another workaround would be using a custom preview and handle rendering states entirely by custom code.