3rd state for app.branch (and doc alteration)

The docs here (https://anvil.works/docs/version-control) say :

To find out which version of your app is running in code, use anvil.app.branch . If you run the app in the Anvil Editor, anvil.app.branch will be "master" ; if you have published a version of your app and you’re running that, it will be "published".

However, you also get “master” if you access the dev. version outside of the editor.

Could there be a 3rd state, maybe “unpublished”?

In any case, the docs should probably make that clear.

Do you mean “pre-published”? Currently, before you first publish an app, it’s always ‘master’. So if code sees ‘master’, it can’t tell, unless it also happens to know whether that app has ever been Published.

Now, I suspect that if we changed the behavior of anvil.app.branch, we’d break something. So this tri-state query should probably be a separate (new?) member of anvil.app.

1 Like

I think what I mean is “not-published”, ie this is not the version marked as published (whether or not there is even a published version), and we are not in the IDE.

Actually, a new boolean member of (say) “ide” would probably be best. Maybe. Not sure.

Moved to Feature Requests, and noted!

(app.branch isn’t likely to change - that is deliberately the name of the Git branch that your app was loaded from. We’ll consider adding more flags to tell you about the context your app is running in, though!)