comments icon indicating copy to clipboard operation
comments copied to clipboard

Cannot read properties of null (reading 'cloneNode')

Open vonscriptor opened this issue 8 months ago • 1 comments

Describe the bug

When I'm not logged in (currentUser) and have Guest commenting disabled I get the following error:

comments.js?v=1741894275:1 Uncaught TypeError: Cannot read properties of null (reading 'cloneNode')
    at n.init (comments.js?v=1741894275:1:5532)
    at new n (comments.js?v=1741894275:1:194)

This is the line with the error: this.commentForm = this.$baseForm.cloneNode(!0),

this.$baseForm (this.$baseForm = i.querySelector('[data-role="form"]'),) does not exist for me in the DOM.

It works correctly when I am logged in.

Steps to reproduce

  1. Disable Guest commenting
  2. Don't be logged in
  3. Go to a page with comments

Craft CMS version

5.6.11

Plugin version

3.0.6

Multi-site?

No

Additional context

I am using the Template Folder Override, but removed it to test and still get the error.

vonscriptor avatar Mar 15 '25 17:03 vonscriptor

Fixed for the next release. To get this early, run composer require verbb/comments:"dev-craft-5 as 3.0.6".

engram-design avatar Mar 17 '25 01:03 engram-design

Updated in 3.0.7.

engram-design avatar Jul 18 '25 14:07 engram-design