Fixed Uncaught (in promise) TypeError: lastRow is undefined

TickTackk

Well-known member
Affected version
2.3.x
Code:
Uncaught (in promise) TypeError: lastRow is undefined
    _appendRows https://basement/js/xf/filter.js?_v=4acd361b:519
    _filterAjaxResponse https://basement/js/xf/filter.js?_v=4acd361b:266
    _filterAjaxResponse https://basement/js/devjs.php?addon_id=SV/StandardLib&js=sv/lib/xf/filter.js:183
    proxy https://basement/js/xf/core.js?_v=4acd361b:3804
    onSuccess https://basement/js/xf/core.js?_v=4acd361b:1834
    ajax https://basement/js/xf/core.js?_v=4acd361b:1962
    promise callback*ajax https://basement/js/xf/core.js?_v=4acd361b:1957
    _filterAjax https://basement/js/devjs.php?addon_id=SV/StandardLib&js=sv/lib/xf/filter.js:163
    filter https://basement/js/devjs.php?addon_id=SV/StandardLib&js=sv/lib/xf/filter.js:261
    update https://basement/js/xf/filter.js?_v=4acd361b:174
    update https://basement/js/devjs.php?addon_id=SV/StandardLib&js=sv/lib/xf/filter.js:248
    svPerPageOnTimer https://basement/js/devjs.php?addon_id=SV/StandardLib&js=sv/lib/xf/filter.js:127
    proxy https://basement/js/xf/core.js?_v=4acd361b:3804
    setTimeout handler*svPerPageChange https://basement/js/devjs.php?addon_id=SV/StandardLib&js=sv/lib/xf/filter.js:106

In js/xf/filter.js
JavaScript:
            const existingRows = this.search.querySelectorAll(this.options.searchRow)
            const lastRow = existingRows[existingRows.length - 1]
            let lastRowContainer = null
            const searchRowGroup = this.options.searchRowGroup
lastRow can be undefined.

Edit: To reproduce make use of data-xf-init="filter" with data-search-row having some value.
 
Last edited:
The _appendRows function has another bug:

Code:
if (lastRowContainer)
{
...
else
{
   this.search.append(rows)
}

The this.search.append results in [NodeList] being inserted instead of the actual rows
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.3).

Change log:
Fix some issues with appending filter rows
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom