I have a function to set up some object called project_task
every time the composer is opened.
I did it this way because I saw it in the events plugin:
the issue that i have now is, that my object is not always there. It seems like the function does not always run when the composer changes. If i switch back and forth between different drafts of different topics its not called again, so the code that depends on the object being there does not work anymore.
My question is: which function do I need to use if I want to setup this object anytime the composer is opened with a different topic or if its opened for the first time? I want to make sure this object is always there.
EDIT:
This is how I solved the problem for now
But this is still not perfect, because it forces us to throw away the draft when we press edit on another
topic. sometimes without warning. (maybe that is because my saving to draft stuff does not work 100% perfectly or I just clicked too fast and the draft wasnt saved yet)
I guess this is the default behavior of the composer at the moment. I just verified in this forum, that you can only have one edit draft at one time.
When I press new topic in this forum then it lets me save stuff, so there seems to be the option to have one edit draft and one new draft.
I found this thread again:
It seems like this is the behavior of the composer how its intended.
To me this seems really intuitive and thats why I thought its a bug. I didnt get the error message at first when it forced me to discard or cancel, because it didnt even occur to me that there could be a limitation on open drafts.