Do you have a link where I could see this happening?
We have the same issue in commentpress-core:3.9.3. It happens when the comment being added is the first on its paragraph, because line 958 of cp-ajax-comments.js calls last_id.toString() but last_id is empty due to this being the first comment (see line 945 last_id = $(last).prop(‘id’); ).
The plugin should definitely not alert() this error in any case, but I’m not sure how you want to handle it or I would be happy to submit a PR myself.
You can see it in action at https://cyborguniversity.hcommons.org/.
@cyclic Thanks for the report. I (kind of) agree that errors should be logged to the console if it exists, but often this is a symptom of a deeper issue as you can see from the history of reports here. It’s thankfully also relatively rare.
I’d like to know a little more about your setup, because I cannot reproduce this error locally regardless of which PHP version, WordPress version or which combination of plugins I use. If you’d prefer to take this conversation off this public forum to discuss this, please email me at [email protected].
I discovered that disabling the comment group of our Redis object cache makes the comments show up under the correct paragraph and thereby fixes the JS error. Here’s how I did it:
/**
* Comments are not nested correctly if caching is on, so disable it for commentpress.
*/
function hcommons_selectively_disable_object_cache() {
$theme = wp_get_theme();
if ( false !== strpos( strtolower( $theme->get( 'Name' ) ), 'commentpress' ) ) {
wp_cache_add_non_persistent_groups( array( 'comment' ) );
}
}
add_action( 'plugins_loaded', 'hcommons_selectively_disable_object_cache' );