Problem/Motivation

There is a console error when editing an image:

Uncaught TypeError: Cannot read property 'querySelector' of null
at :9:83
at :15:2
at b (jquery.min.js?v=3.5.1:2)
at Function.globalEval (jquery.min.js?v=3.5.1:2)
at Object.dataFilter (jquery.min.js?v=3.5.1:2)
at jquery.min.js?v=3.5.1:2
at l (jquery.min.js?v=3.5.1:2)
at XMLHttpRequest. (jquery.min.js?v=3.5.1:2)
at XMLHttpRequest.send (:1:774)
at Object.send (jquery.min.js?v=3.5.1:2)

The error however this is not affecting functionality.

Comments

Gaurav_drupal created an issue. See original summary.

gaurav_drupal’s picture

StatusFileSize
new923 bytes

Provided a patch, please review

gaurav_drupal’s picture

Assigned: gaurav_drupal » Unassigned
Status: Needs work » Needs review
darienmh’s picture

For version 8.x-1.2 work this

ricardochefigueroa’s picture

StatusFileSize
new754 bytes

For version 8.x-1.2

rescandon’s picture

Version: 8.x-1.1 » 8.x-1.2
Status: Needs review » Reviewed & tested by the community

The patch is working and the console error is fixed

drews_man’s picture

Also, this patch fixes one more bug - when you add more than one table to the page. Only one table will work because this line of code get only the first table from DOM.
document.querySelector('.table--widget-entity_reference_browser_table_widget').querySelector('tbody').classList += ' entities-list sortable ui-sortable';

I wrote another solution for my problem, but the solution from the patch I prefer more.

My solution:

var tables = document.querySelectorAll('.table--widget-entity_reference_browser_table_widget');
    tables.forEach( function (table) {
      table.querySelector('tbody').className += ' entities-list sortable ui-sortable';
    });

Thanks, guys!

alphawebgroup’s picture

Status: Reviewed & tested by the community » Needs work

The patch can not be applied any more...

rutiolma’s picture

Status: Needs work » Needs review
StatusFileSize
new849 bytes

Updated patch to use with latest version

rutiolma’s picture

Status: Needs review » Closed (duplicate)

In fact, I believe we should close this one in favor of #3246565 which provides a better patch which addresses the same issue.