I am using the Insert module with the Media Library module and I'm seeing the following JS error when no files have been uploaded to the field: "drupal.js?v=8.7.2:13 Uncaught TypeError: Cannot read property 'classes' of undefined at aggregateClassesToRetain (insert.js?v=2.x:112)".

CommentFileSizeAuthor
#2 insert-js-error-no-files_3059762_1.patch467 bytesrromore

Comments

rromore created an issue. See original summary.

rromore’s picture

StatusFileSize
new467 bytes

Attaching a patch that ensures the `drupalSettings.insert.classes` object exists before attempting to use.

rromore’s picture

Version: 8.x-2.x-dev » 8.x-2.0-beta1
snater’s picture

Thank you. That seems to be a valid hotfix. The optimum would be Insert not yet initializing under that circumstance. I will have a look into that as soon as I have a bit of time.

  • Snater committed d6230c1 on 8.x-2.x
    Issue #3059762 by rromore: JS error when no files are available for...
snater’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.