User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Look like [].slice.call
does not accept undefined
as a valid argument, so when there no filter container defined in search tool, this line of code https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media_source/system/js/searchtools.es6.js#L289 throws some error in console.
Uncaught TypeError: Cannot convert undefined or null to object
at slice (<anonymous>)
at Searchtools.checkActiveStatus (searchtools.js?c804da20519ee3655f5ac687001b9f31321af327:262)
at new Searchtools (searchtools.js?c804da20519ee3655f5ac687001b9f31321af327:194)
at HTMLDocument.onBoot (searchtools.js?c804da20519ee3655f5ac687001b9f31321af327:504)
This PR prevents that error by adding a if check, similar with what we do in other places in that script, for example https://github.com/joomla/joomla-cms/blob/4.0-dev/build/media_source/system/js/searchtools.es6.js#L177
As this only happens on third party extensions (found this while testing my extensions), it's hard to call for end-users test. Hopefully code review would be enough. @dgrammatiko @Fedik Could you help?
Status | New | ⇒ | Pending |
Category | ⇒ | JavaScript Repository NPM Change |
Labels |
Added:
NPM Resource Changed
?
|
@dgrammatiko Yeah, better. And with that change, we can remove the if check before calling forEach in other places, thus optimize the process a bit :). Could you please check it again?
Approved
@dgrammatiko If you mark your test result in the issue tracker (with a comment "Code review" or so maybe), then it will count
Help, please :). Otherwise I will ping you every time I hear from anyone reporting this bug with my extensions :D (joke).
I have tested this item
Code Review
I have tested this item
Real test with one of @joomdonation 's extensions:
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-08-01 23:23:32 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
Probably just change the
getFilterFields
?and also
const els = [].slice.call(this.getFilterFields());
toconst els = this.getFilterFields();