agileware-jp / redmine_issue_templates

Redmine Issue Template. Pull requests, reporting issues, stars and sponsoring are always welcome!
https://www.redmine.org/plugins/redmine_issue_templates
GNU General Public License v2.0
65 stars 28 forks source link

JavaScript error when changing tracker #2

Closed yui-har closed 3 years ago

yui-har commented 3 years ago

If you change the tracker on the issue creation form, the issue template with the default settings will be displayed, but the setting values will not be displayed on the screen due to an error in JavaScript.

Uncaught SyntaxError: Identifier 'load_url' has already been declared
    at b (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at Pe (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at s.fn.init.append (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at s.fn.init.<anonymous> (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at $ (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at s.fn.init.html (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at Object.<anonymous> (issue_templates.js?1614134447:187)
    at c (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at Object.fireWith [as resolveWith] (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)
    at l (jquery-3.5.1-ui-1.12.1-ujs-5.2.3.js?1613355381:2)

I think the cause is that the scope of the variable defined by let is global. To solve this, I redefined it with an anonymous function.

yui-har commented 3 years ago

@zh, Thank you for merging.