Saving draft code

I write a code (no assigned devices) and save it (?), I think so - message “saved a few seconds ago”.
Then I switch to another code in order to copy some part of it in to code I’m writing, but…I cannot see code anymore, blank fields.
What I’m doing wrong or this is a bug? Is it necessary to save code with “Build and deploy”?
What I’m doing wrong? It’s some my mistake or some bug?
On Legacy IDE it never happen…

Hi @PeterAP,

Thank you for the bug report! This does indeed sound like an issue and not user mistake. Sorry for the inconveniences!

After further review, we found a sneaky way to cause a similar issue using newly created groups. We will continue investigating and document the related problem for resolution in next available release.

Normally this bug should not happen. Automatic draft saving happens for mid-work code editor every 10 seconds, or immediately if you leave the view to go somewhere else. Each group has their own draft and should not be overwritten by drafts in other groups. Just to make sure we’re not missing something extra, do you remember which user flow you used to swap to a different group’s code editor (for example, do you use the group pulldown from code editor, side nav, or something else)?

You can certainly use any of the Build buttons in code editor whenever you want, those will actually save the code as a real deployment rather than just draft state. This allows for other features such as reverting to that version later if desired. If you want to save a new deployment build but not run any new code on any assigned devices yet, the bottom “Build” button pulldown option without “restart” is probably the right choice.

Oh also, it was noted the “last saved” message isn’t very helpful for relative time when it doesn’t auto update within the view. This might change to timestamp for more clarity or something else better in the future.

Again, sorry for the issue inconvenience and thank you for reporting!

Thanks for explanation!
I suppose that it happen by choosing from Product pull-down menu.
In overall that happen 2 times: 1) as I described above, 2) when I sweep web page by touchpad (I use Safari 11.1, OSX10.11.6, MacBook Air).
I’m lucky that only some 20-25 lines of code I must rewrite again each time and that isn’t a big problem.
Disappointment was “where are the code? what I do wrong?” :)…as usual :slight_smile:

Ok, makes sense, thank you @PeterAP!

We’ll get a fix in for the edge scenario which can result in not yet saved work-in-progress to land at incorrect last auto saved draft state.

I would recommend you use the Build button a little more though, that will definitely save code as a real deployment object, which has its own attributes and can be referenced later etc. The auto draft saving is meant as a convenience and not meant for long term development cycles — drafts don’t get saved forever, for example, they’ll be reaped if untouched for three months. Definitely not intentional that draft is causing you this issue though, sorry for the troubles!