Backport #1681 "Caching of form definition is influenced by document id"

- form definition URL was stored into static state
- the URL depends on the ?document parameter
- so the digest was different for every document loaded