danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
595 stars 158 forks source link

Load on the fly #418

Open Mte90 opened 5 months ago

Mte90 commented 5 months ago

So reading the code on https://github.com/danirus/django-comments-xtd/blob/master/django_comments_xtd/static/django_comments_xtd/js/src/index.js#L6

Seems that if the selector doesn't exist there is a JS crash (I can confirm it) but also if the comments are loaded after the library loading this is not possible (remember https://github.com/danirus/django-comments-xtd/issues/334).

My user case is that I have the comments in some pages but in others they are showed after a clicked (loaded with HTMX so they aren't in the HTML yet).
Ideally this cose should check in runtime for new items, also the problem is that natively uses the ID that need to be unique.

I will work on a PR.