diff --git a/core/docs/changelog.txt b/core/docs/changelog.txt index ee92a58a0c3..2261dbce310 100644 --- a/core/docs/changelog.txt +++ b/core/docs/changelog.txt @@ -7,6 +7,7 @@ development release, and is only shown to give an idea of what's currently in th - Fix horizontal overflow on Context Access grid (#16380) - Grid filtering via URL parameters added to most grids in the manager (#16089, #16369) - Store last opened media browser path in browser history / URL parameters to re-open last path (#16394) +- Fix template picker to avoid errors in certain edge cases (#16400) MODX Revolution 3.0.3-pl (January 17, 2023) ==================================== diff --git a/manager/assets/modext/widgets/resource/modx.window.resource.js b/manager/assets/modext/widgets/resource/modx.window.resource.js index f914b4c29ee..66f91b4a4de 100644 --- a/manager/assets/modext/widgets/resource/modx.window.resource.js +++ b/manager/assets/modext/widgets/resource/modx.window.resource.js @@ -256,22 +256,21 @@ Ext.extend(MODx.combo.TemplatePicker, Ext.Panel, { columns: 1, items: items, listeners: { - 'render': { - fn: function(tf) { - var value = tf.getValue(); - - if (value.record) { - this.fireEvent('select', value.record); + render: { + fn: function(cmp) { + const value = cmp.getValue(), + record = value?.record + ; + if (record) { + this.fireEvent('select', record); } }, scope: this }, - 'change': { - fn: function(tf) { - var value = tf.getValue(); - - if (value.record) { - this.fireEvent('select', value.record); + change: { + fn: function(cmp, checked) { + if (checked.record) { + this.fireEvent('select', checked.record); } }, scope: this