--- OC-5819   Performance issue due to unnecessary repeated generation o...

Pull request for OC-5819. Fix of the repeated generation of JS-code. See JIRA on OC-5819 for details.