jazzband / django-recurrence

Utility for working with recurring dates in Django.
https://django-recurrence.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
477 stars 188 forks source link

Multiple Recurrence widgets on the same page cause a JS mess #269

Open sheepman4267 opened 1 year ago

sheepman4267 commented 1 year ago

I think I can work around this in my app, but I think it should be known that if one has multiple recurrence widgets on the same page, you get JS errors in the console and only the first one functions. I'm not a JS developer, so I don't know how hard this would be to fix. Here's the error you get, seemingly once for each widget past the first:

Uncaught SyntaxError: Identifier 'callback' has already been declared (at recurrence-widget.init.js:1:1)

This error also seems to occur when an ajax request (such as HTMX replacing the element containing a recurrence widget) adds another recurrence widget to the page. In that case, neither widget works until the page is fully reloaded.